forro

Forro is a end-to-end encrypted contract form based on PGP.
git clone git://git.defalsify.org/forro.git
Log | Files | Refs | LICENSE

commit 541a8e9d9da4a039df7afe0bedc5a8d7c363e786
parent 2545860578ec2d63cbddc6544d2991147be5d1c4
Author: lash <dev@holbrook.no>
Date:   Tue, 20 Sep 2022 06:44:39 +0000

Add delete key

Diffstat:
MCHANGELOG | 1+
Mindex.html | 23+++++++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,6 @@ - 0.0.4 * settable passphrase for key encryption + * delete key function - 0.0.3 * add (optional) userid info for sender * use funny names for default userid diff --git a/index.html b/index.html @@ -8,8 +8,8 @@ let g_passphrase_time = new Date(0); let g_remote_key = undefined; let g_local_key = undefined; let g_remote_key_id = '(none)'; -let g_local_key_id = '(none)'; let g_remote_key_name = '?'; +let g_local_key_id = '(none)'; let g_local_key_name = '?'; let g_local_key_identified = false; let g_data_endpoint = window.location.href; @@ -284,6 +284,19 @@ let g_counter = undefined; return r; } + function purgeLocalKey() { + key_id = g_local_key_id; + localStorage.removeItem('pgp-key'); + localStorage.removeItem('msg-count'); + g_local_key = undefined; + g_local_key_id = undefined; + g_local_key_identified = false; + g_passphrase = ''; + g_passphrase_time = new Date(0); + stateChange('deleted local key ' + key_id); + return true; + } + window.addEventListener('messagestatechange', (v) => { console.debug('message state change:', v.detail.s); }); @@ -305,6 +318,7 @@ let g_counter = undefined; realemail: '', message_status: '', message_count: g_counter, + passphrase_status: 'please create key', }" > @@ -312,7 +326,6 @@ let g_counter = undefined; <div x-data="{ passphrase_cache: '', - passphrase_status: 'please create key', }" x-init=" @@ -368,5 +381,11 @@ let g_counter = undefined; <button @click="r = await tryDispatch(content, realname, realemail); rcpt = r;">sign, encrypt and send</button> </div> </div> + <div x-data="{ + rst: false, + }"> + <button x-show='key && !rst' @click='rst = true;'>Discard key</button> + <button x-show='rst' @dblclick='rst = false; passphrase_status = "please create new key"; have_passphrase = false; key = !purgeLocalKey();'>Double click to confirm discard key</button> + </div> </body> </html>