Skip to content

fix(keychain): clear localStorage on disconnect to fix persistent login#2503

Closed
broody wants to merge 1 commit intomainfrom
fix/disconnect-clear-localstorage
Closed

fix(keychain): clear localStorage on disconnect to fix persistent login#2503
broody wants to merge 1 commit intomainfrom
fix/disconnect-clear-localstorage

Conversation

@broody
Copy link
Contributor

@broody broody commented Mar 23, 2026

Summary

  • Fixes disconnect not clearing localStorage in the keychain iframe, causing users to remain logged in after disconnecting
  • The WASM storage.clear() may target a different storage partition than where controller data was written, due to requestStorageAccess() switching the iframe between partitioned and unpartitioned localStorage during the connect flow
  • Adds explicit localStorage.clear() calls from JS after the WASM disconnect in all disconnect/logout paths to ensure the active storage context is always cleared

Test plan

  • Connect a wallet via the controller
  • Call disconnect
  • Verify localStorage in the keychain iframe (via devtools) is cleared
  • Refresh the page and call connect again — user should be prompted to re-login
  • Test in Chrome with third-party cookie restrictions enabled
  • Test in Safari

🤖 Generated with Claude Code

The WASM storage.clear() during disconnect may clear a different storage
partition than where controller data was originally written. This happens
when requestStorageAccess() switches the iframe from partitioned to
unpartitioned localStorage during the connect flow — subsequent clear()
calls target unpartitioned storage while the data remains in the
partitioned partition.

Add explicit localStorage.clear() calls from JS after the WASM disconnect
in all disconnect/logout paths to ensure the active storage context is
cleared regardless of partition state.

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

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
controller-example-next Ready Ready Preview Mar 23, 2026 8:52pm
keychain Ready Ready Preview Mar 23, 2026 8:52pm
keychain-storybook Ready Ready Preview Mar 23, 2026 8:52pm

Request Review

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