// Persistent 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: (a) lock-on-close and auto-lock are suppressed so // the in-memory key needed to re-derive the words survives a popup close, and // (b) on the next successful unlock (even after a full browser restart), the // popup re-routes to the recovery-words display instead of the entries view. // // Lives in chrome.storage.local so the flag survives browser restart. Cleared // on confirmation success and on DESTROY_VAULT (storage.local.clear()). const KEY = "peach_recovery_pending"; export async function isRecoveryConfirmPending(): Promise { try { if (!chrome.storage?.local) return false; const out = await chrome.storage.local.get(KEY); return (out as Record)[KEY] === "1"; } catch { return false; } } export async function setRecoveryConfirmPending(): Promise { try { await chrome.storage.local?.set({ [KEY]: "1" }); } catch { /* best-effort */ } }