- your key lives only in this browser; back it up if you want it on another device or after clearing data.
+
+ your key lives only in this browser; back it up if you want it on another device or after clearing data. log out wipes it and generates a fresh identity.
backup — pick a password; you'll get a text blob to save.
@@ -455,6 +456,22 @@ function setVaultStatus(msg, cls){
function renderIdentity(){ $('pub-short').textContent = myKeys ? shortHex(myKeys.pubHex) : ''; }
$('btn-vault').addEventListener('click', () => $('vault-panel').classList.toggle('hidden'));
+
+/* log out — destructive: wipes Ed25519 + handle from localStorage and
+ * generates a fresh identity. The booted/blocked window keys off the
+ * pubkey, so logging out is also the escape hatch from a room block.
+ * The user keeps the same browser so we generate a new key right away;
+ * otherwise the page would refuse to enter any space (no identity). */
+$('btn-logout').addEventListener('click', async () => {
+ if (ws){ setStatus('leave the space first','err'); return; }
+ if (!confirm('Log out wipes your identity key from this browser. ' +
+ 'If you haven’t backed it up you cannot recover it. Continue?')) return;
+ try { localStorage.removeItem(ID_KEY); localStorage.removeItem(HANDLE_KEY); } catch(_){}
+ myHandle = ''; $('handle').value = '';
+ myKeys = await generateIdentity();
+ renderIdentity();
+ logLine('', 'logged out — fresh identity '+shortHex(myKeys.pubHex));
+});
$('btn-vault-backup').addEventListener('click', async () => {
const pw = $('vault-pass').value;
if (!pw){ setVaultStatus('enter a password first','err'); return; }
@@ -1544,8 +1561,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');