Repository source: docs/plans/browser_keychain/browser_keychain_step2_feature_description.md
Debug mode: enabled
Effort study: railspike-effort / v3/browser_keychain; cycle ledger. Standing P2 enrollment; parent v3/local_pull_simple.
Extended estimates: enabled
Cycle estimate: 0.80
Approved direction: Option A (Approved Step 1, 2026-11-28). Feedback: PF-20261104-F19 "Local keychain and identity switching".
Problem
When a browser's key changes, the old key is lost or kept in one slot (forum_pki_previous_*). A member who uses two keys, or replaces one by mistake, has to find a backup file.
Concepts touched
Browser keychain: proposed, created. Every key this browser has held for the site, kept beside the active key, with switch and remove on Account.
Key backups: changed. Restoring a backup of a different key adds it to the keychain instead of being refused.
Key handoff: changed. Connect adds the old key to the keychain instead of
forum_pki_previous_*.Private key access, key retirement, replaced key: used unchanged. Removing a key from a browser retires nothing on the server.
User stories
As a member with two accounts, I want to switch keys on Account so that I don't sign out and restore a backup each time.
As a member who restored the wrong backup, I want my previous key still listed so that I can switch back with one click.
As a member on a shared computer, I want Remove to take a key off this browser so that the next person can't post as me.
As a member who removed a key by mistake, I want Undo to work after a reload so that a stray refresh doesn't cost me the key.
Core requirements
Every key that becomes active goes into the keychain first. That covers making a key (Continue, the automatic guest key and the key bootstrap), backup restore, clipboard restore, Connect and Undo. No key appears twice.
On Account, the keychain lists each key by name and short fingerprint, with the active key marked. Other keys have Use this key. It signs this browser's session out of the old key and into the chosen one, as a restore does today.
Remove this key deletes the key from the keychain and the active slot, along with that key's saved message copies. Other keys and their copies stay. Undo stays offered for five minutes, across reloads. After that the key is gone from
localStorage. Removing the active key leaves no key active; the other keys stay listed.Restoring a backup of a different key adds it and makes it active. This replaces today's refusal in
importAccountPrivateKey.On first load,
forum_pki_previous_*moves into the keychain and is deleted.
Decisions on the Step 1 questions
Where the switcher lives: Account only. The header shows the active name as a link (
toolbar_identity_status.js), not a menu. It already follows a key change.Saved message copies: switching keeps them.
private_message_cache.jsstores entries under the owner's fingerprint, so each key reads only its own. Removing a key deletes only that key's copies, not the whole database asclearBrowserIdentitydoes today.Other open tabs: they learn through the
storageevents they already handle forforum_pki_*. Account in another tab also redraws the keychain. There is no new channel.Member's own labels: not in this cycle. Name and short fingerprint tell keys apart, and a label is one more control to explain.
Saying removal isn't retirement: the Remove dialog already says posts stay under the name. No new copy is needed.
Delivery scope
Work type: application change.
Completion boundary: a member opens Account and switches, removes and undoes through ordinary controls. Every path that writes the active key adds it to the keychain. A failed switch leaves the previous key active and shows a short message with Details. Release once the smoke set and the changed browser checks pass.
Risks
Switching mid-request in another tab. A post signed in one tab could go out under the key just switched to in another. Validate early: replay the existing
stillInstalledguard for a switch. Mitigation: switch through the same path a restore takes, guard included.Keychain clutter from guest keys. An automatic guest key is made on first visit, so most browsers gain an entry nobody asked for. Validate: count entries in a fresh browser that later restores a key. Mitigation: show the keychain only when it holds more than one key.
More private keys in
localStorage. They are as exposed as the active key is today. Removal and the five-minute Undo window bound how long a removed key lingers. Browser storage clearing (Safari's seven days) still removes the whole keychain, so it is no substitute for a saved copy.
Shared component inventory
templates/pages/account_key.php: reuseaccount-groupandaccount-rowfor keychain entries. Reuse the#key-removedialog,undo-removeandsimple-status.public/assets/browser_signing.js: extendsaveImportedBrowserIdentityand the key-making path as the single place that also adds to the keychain. ReuseimportAccountPrivateKeyfor Use this key. Replace the in-memorysaveClearedKeypairBackupandrestoreClearedKeypairBackupwith a stored Undo. ChangeclearBrowserIdentityto delete one key's copies.public/assets/private_message_cache.js: add a delete for one owner besideclearAll.public/assets/local_message_pull.js: retireforum_pki_previous_*and its status note.public/assets/key_backup_ui.js,key_bootstrap.js,key_handoff.js,key_backup_status.js,toolbar_identity_status.jsand the otherstoragelisteners: reused unchanged.tests/browser/key_handoff.mjs: update its previous-key check.
User flow
A member with key X restores a backup of key Y on Account.
Y becomes active. The keychain shows Y marked and X with Use this key.
Use this key on X signs this browser in as X. The header and other tabs show X.
The member removes Y and reloads. Undo is still offered.
Five minutes later, Y is gone from
localStorageand only X is listed.
Success criteria
Each of the seven key-writing paths above leaves the new key and the old one in the keychain. A browser check covers restore, Connect and Undo.
After a switch, the server session and
forum_pki_fingerprintname the chosen key. An open second tab shows it without a reload.After a removal, a reload still offers Undo. After five minutes, no
localStoragevalue holds the removed key, and its saved copies are gone. The other key's copies remain.A browser with
forum_pki_previous_*shows that key in the keychain after one load, and the old values are gone.
— Claude · 2026-11-28 UTC · Model: claude-opus-5-5
Enhancement Requests
Request: "Log out but keep key" from PF-20261104-F19. Disposition: pending. Option A has no sign-out that keeps the key; Use this key and Remove cover switching and shared computers. Adding it means one more control on Account. Approval: awaiting Ilya. Outcome: none yet.
Study Checkpoint
2026-11-28T18:40Z; scope v1; starting revision 1d98d94b; R1 (hashes not re-verified); P2 standing enrollment, parent v3/local_pull_simple. Claude, single exposed rater.
Step 2 handoff: 0.80 projected total (Step 1 0.70). Raised for new understanding, not changed scope: seven key-writing paths instead of four, the restore refusal to undo, and per-key deletion of saved copies. Not hours or measured labor; no approval to advance.