commit 55836661bf2b57a432e82e4fa8e5c8f1a7a2415b
parent fa6681d65a65bf08a113dc8ee947a6faee7d50f1
Author: lash <dev@holbrook.no>
Date: Fri, 11 Nov 2022 07:22:31 +0000
Encrypted private key exports, settable email sender
Diffstat:
6 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,6 @@
+- 0.0.8
+ * Private key link returns encrypted armor key
+ * Override email sender and sender name through settings
- 0.0.7
* Replace btoa with base64.js from mime-js
- 0.0.6
diff --git a/ROADMAP b/ROADMAP
@@ -1,2 +1,2 @@
-- 0.0.7
+- 0.0.8
* Basic but usable responsive UX for vertical format
diff --git a/app.js b/app.js
@@ -106,6 +106,12 @@ async function setUp() {
g_data_endpoint = settings.data_endpoint;
stateChange('updated data endpoint to ' + settings.data_endpoint);
}
+ if (settings.email_sender) {
+ g_from = settings.email_sender;
+ }
+ if (settings.email_sender_name) {
+ g_from_name = settings.email_sender_name;
+ }
stateChange('loaded settings', STATE['SETTINGS']);
let r = await fetch(settings.remote_pubkey_url);
@@ -484,7 +490,7 @@ async function tryHelpFor(...k) {
async function buildMessage(message, files, pubkey) {
let msg = {
- fromName: 'Forro v' + g_version,
+ fromName: g_from_name,
from: g_from,
to: g_remote_key_email,
subject: 'contact form message',
@@ -512,6 +518,7 @@ async function buildMessage(message, files, pubkey) {
return msg_mime;
}
+
window.addEventListener('messagestatechange', (v) => {
state_change = (~v.detail.old_state) & v.detail.state;
let s = v.detail.s;
diff --git a/index.html b/index.html
@@ -59,12 +59,12 @@
@messagestatechange.window='
message_status = $event.detail.s;
message_count = $event.detail.c;
- last_state = $event.detail.state;
+ last_state = $event.detail.state;
if (!unlock_set && checkState(STATE["LOCAL_KEY_DECRYPTED"])) {
unlock_set = true;
$dispatch("unlocked");
- }
- if (checkState(STATE["PASSPHRASE_FAIL"])) {
+ }
+ if (checkState(STATE["PASSPHRASE_FAIL"])) {
$dispatch("passfail");
}
if (checkState(STATE["ACK_MESSAGE"])) {
@@ -204,7 +204,9 @@
filez: {},
get localKeyArmor() {
- return 'data:text/plain;charset=utf8,' + this.key_content;
+ let k = getEncryptedKey();
+ //return 'data:text/plain;charset=utf8,' + this.key_content;
+ return 'data:text/plain;charset=utf8,' + k;
},
get localKeyFilename() {
return 'privatekey_' + this.key + '.asc';
diff --git a/key.js b/key.js
@@ -26,13 +26,16 @@ async function generatePGPKey(pwd, uid) {
});
}
-async function getKey(pwd) {
+async function getKey(pwd, encrypted) {
return new Promise(async (whohoo, doh) => {
let pk_armor = localStorage.getItem('pgp-key');
if (pk_armor === null) {
doh('no key');
return;
}
+ if (encrypted) {
+ return whohoo(pk_armor);
+ }
let pk = await openpgp.readKey({
armoredKey: pk_armor,
});
@@ -53,6 +56,10 @@ async function getKey(pwd) {
});
}
+function getEncryptedKey() {
+ return localStorage.getItem('pgp-key');
+}
+
async function generateAuth(pk, msg) {
let sig = await openpgp.sign({
signingKeys: g_local_key,
diff --git a/top.js b/top.js
@@ -40,5 +40,6 @@ let g_state = 0;
let g_helpstate = 0;
let g_counter = undefined;
let g_files = {};
-let g_version = '0.0.7';
-let g_from = 'no-reply@holbrook.no';
+let g_version = '0.0.8';
+let g_from = 'no-reply@localhost';
+let g_from_name = 'Forro v' + g_version;