Skip to content

feat(web): ask the browser to keep the storage that holds the key - #206

Merged
Yoshiofthewire merged 1 commit into
masterfrom
feat/persistent-storage
Nov 25, 2026
Merged

Yoshiofthewire merged 1 commit into
masterfrom
feat/persistent-storage

Conversation

@Yoshiofthewire

Copy link
Copy Markdown
Member

In one line: KyNotes now asks the browser not to clear the storage that holds this browser's encryption key.

What changed

  • Once the vault keeps the key, KyNotes asks for persistent storage, but only if the site doesn't already have it. This happens at sign-in and when a key is set up, linked or restored.
  • With persistent storage, the browser no longer clears KyNotes's storage on its own to free disk space. In Safari it may also survive the 7-day cleanup of sites that haven't been visited; WebKit only says "might".
  • Firefox shows a permission prompt. Chromium and Safari decide silently based on how much the site is used. If the browser says no, nothing changes.
  • The user can still clear the storage, and "Forget this device" still removes the key.
  • Security is unchanged: the key was already on disk in IndexedDB. This only stops the browser deleting it unasked.
  • It doesn't help in Ladybird, which doesn't save IndexedDB to disk at all (LadybirdBrowser/ladybird#15594).

Review this: web/src/storage.ts storeIdentityKey: the request runs only after the vault has kept the key, and it doesn't block saving. web/src/persist.ts: it doesn't ask again once storage is persistent, and it swallows errors.
Checked: npm test (698 passed, including 3 new keepStorage cases); new e2e persistent-storage.e2e.ts in Chromium, which passes on this branch and fails on master's bundle (Received: false); npm run build with Node 26.13.1 plus CI's diff -qr web/dist internal/web/dist; go build, go vet, go test ./internal/web/....
Not checked: the Firefox prompt and Safari by hand.
Decided for you: we ask when the key is saved, not on page load, so the Firefox prompt appears right after the user signs in or sets up a key.
You need to: nothing.

Detail

Part of a suite-wide change: KyIdentity (trusted-browser keyring key) and KyMessages (end-to-end encryption store) get the same request. Other Ky apps keep only preferences or service-worker caches, which can be rebuilt, so they don't need it.

What it protects: for a password account, losing the browser's storage means signing in again. For a sign-on account, it means entering the recovery code or linking from another browser. Without a recovery code, the user can't create keyed personal notebooks in the first place (team-keys P5 §4).

keepStorage calls persisted() before persist(), so a browser that already keeps the storage is never asked again. persist() only exists in page context, and the vault is saved there.

🤖 Generated with Claude Code

Once the vault keeps this browser's encryption key, KyNotes asks for
persistent storage, so the browser does not clear the key on its own
to free space or after days without a visit. Firefox asks the user;
Chromium and Safari decide silently. A refusal changes nothing.

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

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪

🧪 PR contains tests

⚡ No major issues detected


⚠️ Review coverage: The following files were not included in this review because of the token budget:

  • internal/web/dist/assets/CanvasPage-CCePUo_W.js
  • internal/web/dist/assets/index-DcxPhBy8.js

Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kynotes-server-206, where it is readable by the operator and expires seven days after the last post.

Review input was truncated; omitted changes were not reviewed.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire
Yoshiofthewire merged commit 88c85c8 into master Nov 25, 2026
14 checks passed
@Yoshiofthewire
Yoshiofthewire deleted the feat/persistent-storage branch November 25, 2026 23:48
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