Skip to content

feat(app): remove the phrase backup feature - #871

Draft
p-diogo wants to merge 6 commits into
mainfrom
feat/stop-new-phrase-backups
Draft

p-diogo wants to merge 6 commits into
mainfrom
feat/stop-new-phrase-backups

Conversation

@p-diogo

@p-diogo p-diogo commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Merging this to main deploys the PRODUCTION vault app. Pedro merges. Phrase safety: it needs an independent review first.

What

Removes the phrase backup feature from the vault app: create, restore (relay and file), list, delete, and their copy, code, tests, e2e scripts and guide. Assumes no real production users, so there is no migration. An existing backup can no longer be opened from the app.

  • The phrase is never stored on the device, in any form (Pedro, 2026-12-01). No build ever wrote one and nothing needs it after setup: unlock and signing use the wrapped keys. As a guard, the fields wrapped_phrase, phrase, mnemonic and recovery_phrase are dropped from every record write and hidden from every read. Other unknown fields pass through.
  • 4 words at 4 random positions are confirmed at setup (Pedro, 2026-12-02; replaces "all 12" of 2026-12-01, and the original 3). Positions are distinct, drawn with crypto.getRandomValues (rejection sampling, no bias), shown ascending, and drawn again each time the user goes back to the phrase; never the same set twice in a row. They stay fixed while the check is open, so retrying cannot narrow them down. The phrase is not on screen during the check. Each box takes one word: pasting or typing several fills nothing and says so; one pasted word is fine. A mismatch is reported once for all four boxes after all are filled, never which box and never the right word. The copy says the check covers only these 4 words, asks the user to check every word of their copy, and says there is no backup: a lost or wrongly saved phrase cannot be recovered.
  • A failed setup keeps the phrase. Retry uses the same phrase, new or imported. Only a confirmed "Start over" discards it.
  • One vault per device. Before, a locked device could store a second vault; passkey unlock then opened whichever key sorts first, and a write was signed with that vault's key. A different vault is now refused while a live record exists, and /bootstrap redirects to /unlock on a locked device.
  • Writes fail closed: no signing without unlocked keys and a known Smart Account.
  • A TTL refresh never restores a forgotten record: it re-reads and saves in one IndexedDB transaction, and skips when the record is gone or has a new passkey.
  • "Forget this device" removes every local record of this app (all vaults, expired or unreadable records, its localStorage and this tab's sessionStorage). It works on the front, phrase-entry and locked views and in Settings, says what it removes and leaves, and reports a failure instead of claiming success.
  • The phrase is cleared from page state after use. Settings says that the device forgets the vault after 30 days without an unlock.

Order

App first. The relay still accepts /v1/escrow* until a follow-up removes the routes. Stored rows and the table are not dropped without Pedro's explicit approval.

Tests (head 2ed342a0)

  • tsc -b, vite build, vitest: 382 passed (29 files).
  • Mutations, all caught: 78 on the setup page and the position picker this round (3 survivors first, each fixed by a new test), plus the earlier mutations on other files, which this round does not touch. Covered: the phrase guard, the 4-word check (randomness: distinct, in range, unbiased, new set on return; gating; paste rules), fail-closed writes, TTL refresh, Forget, one vault per device, phrase identity and persistence, page state, import gates, zeroing.
  • Playwright with a virtual authenticator, local dev server against staging, passing: no-new-backup, idle-lock, bootstrap-unlock, and the tools/qa-vault.mjs unlock driver. Run with a newer cached Chromium than the pinned one.
  • Not run: real devices; memory reads are not covered.

New devDependency: jsdom 25. It also moves the transitive hasown in the lockfile.

Limits

  • The guard knows four field names. A phrase hidden under another name is caught by the tests' exact field list, not at run time.
  • The check proves 4 of the 12 words, not the whole phrase. A user can still save a wrong word at another position; the copy says so.
  • One word at a time can still be pasted, so a user who copied single words from the screen can pass.
  • Other unlocked tabs stay unlocked after Forget (the copy says so). If a tab is at the passkey prompt while another tab forgets, it still unlocks in memory; it stores no record and cannot sign.
  • Two tabs that save a new vault in the same instant can still store two. A device that already holds two keeps both until Forget.
  • A reload on the retry screen loses the phrase (memory only; the screen says so). A retry after the passkey was created leaves an unused passkey.

🤖 Generated with Claude Code

Keep restore, list and delete for backups that already exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Vault SPA preview: https://3148c600.totalreclaw-app.pages.dev

Backed by staging relay (api-staging.totalreclaw.xyz).

p-diogo and others added 2 commits December 1, 2026 17:40
… guards

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@p-diogo p-diogo changed the title feat(app): stop creating phrase backups (restore, list and delete stay) feat(app): remove the phrase backup feature Dec 1, 2026
p-diogo and others added 3 commits December 1, 2026 18:03
…t zeroing and import gates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… local record

Writes fail closed without a known open vault, and a TTL refresh never
restores a record that another tab forgot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pedro, 2026-12-02; replaces confirming all 12 words. Positions are
distinct, drawn with crypto.getRandomValues (rejection sampling), shown
ascending, and drawn again on each return from the phrase. The phrase is
hidden during the check; a box takes one word and a multi-word paste
fills nothing and says so; a mismatch never names the box or the word.
The copy says the check covers only these words and that a lost or
wrongly saved phrase cannot be recovered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant