Skip to content

feat(keyring): ask the browser to keep the trusted-browser key - #306

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

Yoshiofthewire merged 1 commit into
masterfrom
feat/persistent-storage

Conversation

@Yoshiofthewire

Copy link
Copy Markdown
Member

In one line: KyIdentity now asks the browser not to clear the storage that holds this browser's suite keyring key.

What changed

  • When a browser saves its keyring device key (marking it as trusted), or later finds one it already has, KyIdentity asks for persistent storage. It doesn't ask if the site already has it.
  • With persistent storage, the browser no longer clears the key 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". Without this, a cleared key turns the browser back into an untrusted one, and the user needs the Emergency Kit, a passkey, or another trusted browser.
  • Firefox shows a permission prompt. Chromium and Safari decide silently. If the browser says no, nothing changes.
  • The user can still clear the storage, and revoking a browser still works as before.
  • Security is unchanged: the key was already a non-extractable key on disk in IndexedDB. This only stops the browser deleting it unasked.

Review this: web/src/keyringDevice.ts: the request runs after the device key is written and when a valid one is found, and it never blocks either. web/src/persist.ts: it doesn't ask again once storage is persistent, and it swallows errors.
Checked: npm test (306 passed, including 3 new keepStorage cases); npm run build with Node 26.13.1, where only the main JS chunk changed; go build ./.... The same helper, in the KyNotes PR, passes a Chromium end-to-end test and fails it without the change.
Not checked: a browser run of keyring setup here. KyIdentity has no committed browser harness for the keyring, and building one for this change wasn't worth it. The Firefox prompt and Safari weren't checked by hand.
Decided for you: we also ask when an existing trusted browser is found, so browsers trusted before this change are covered. That can show the Firefox prompt at a keyring unlock or handoff.
You need to: nothing. #296 also rebuilds web/dist, so whichever merges second needs npm run build again.

Detail

This is part of a suite-wide change. KyNotes (Busnes-app/KyNotes-server#206) and KyMessages get the same request. Other Ky apps keep only preferences or service-worker caches, which can be rebuilt, so they don't need it.

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 keyring runs there.

🤖 Generated with Claude Code

When a browser saves or finds its keyring device key, KyIdentity 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: 1 🔵⚪⚪⚪⚪

🧪 PR contains tests

⚡ No major issues detected


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

  • web/dist/assets/index-B7TFsx-l.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-kyidentity-server-306, 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 added this pull request to the merge queue Nov 25, 2026
Merged via the queue into master with commit 87c485d Nov 26, 2026
14 checks passed
@Yoshiofthewire
Yoshiofthewire deleted the feat/persistent-storage branch November 26, 2026 00:03
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