Skip to content

fix: Persist passphrase across service worker restarts#222

Merged
macterra merged 2 commits intomainfrom
221-persist-passphrase-session-storage
Mar 17, 2026
Merged

fix: Persist passphrase across service worker restarts#222
macterra merged 2 commits intomainfrom
221-persist-passphrase-session-storage

Conversation

@macterra
Copy link
Collaborator

@macterra macterra commented Mar 16, 2026

Summary

  • Move passphrase and extension state from in-memory variables to chrome.storage.session
  • Survives MV3 service worker termination (no more re-login on every archon:// link click)
  • Session storage clears on browser close, maintaining same security model
  • Also works in Firefox (MV2) via browser.storage.session (Firefox 115+)

Closes #221

Test plan

  • Login to Chrome extension, wait for service worker to stop, click an archon://auth link — should not require re-login
  • Close and reopen browser — should require login again
  • Verify Nostr origin approvals still work
  • Test in Firefox extension

🤖 Generated with Claude Code

Move passphrase and extensionState from in-memory variables to
chrome.storage.session so they survive MV3 service worker restarts.
Session storage is automatically cleared when the browser closes,
maintaining the same security model as before.

Closes #221

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Persists the browser extension’s passphrase and general “extension state” across MV3 service worker restarts by moving them from in-memory globals into chrome.storage.session, aligning their lifetime with the browser session (clears on browser close).

Changes:

  • Replace in-memory passphrase with getPassphrase/setPassphrase backed by chrome.storage.session.
  • Replace in-memory extensionState object with getExtensionState/setExtensionState backed by chrome.storage.session.
  • Update chrome.runtime.onMessage handlers to read/write passphrase/state asynchronously via session storage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Add port mapping for the Tor SOCKS proxy (9050) so it can be used
from the host for testing onion connectivity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@macterra macterra merged commit bfd4212 into main Mar 17, 2026
13 checks passed
@macterra macterra deleted the 221-persist-passphrase-session-storage branch March 17, 2026 00:17
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.

Persist extension passphrase across service worker restarts

2 participants