// Session-storage flag set while the user has just created a vault and is // reading their 12 recovery words but has not yet typed the 3 confirmation // words. While the flag is set, lock-on-close and auto-lock are suppressed // — locking would discard the derived key required to re-show the words on // reopen, and the words cannot be recovered without it. // // Lives in chrome.storage.session (RAM-only; cleared on browser restart). // If the browser closes before confirmation, the flag and the in-memory key // are both lost together — the recovery words become unreachable, which is // the same outcome the user would face with any unconfirmed-but-unsaved // secret. const KEY = "peach_recovery_pending"; export async function isRecoveryConfirmPending(): Promise { try { if (!chrome.storage?.session) return false; const out = await chrome.storage.session.get(KEY); return out[KEY] === "1"; } catch { return false; } } export async function setRecoveryConfirmPending(): Promise { try { await chrome.storage.session?.set({ [KEY]: "1" }); } catch { /* best-effort */ } } export async function clearRecoveryConfirmPending(): Promise { try { await chrome.storage.session?.remove(KEY); } catch { /* best-effort */ } }