Skip to content

refactor(seedless-onboarding-controller): keep accessToken out of the vault - #9890

Draft
matthiasgeihs wants to merge 2 commits into
mainfrom
refactor/seedless-token-strategy
Draft

refactor(seedless-onboarding-controller): keep accessToken out of the vault#9890
matthiasgeihs wants to merge 2 commits into
mainfrom
refactor/seedless-token-strategy

Conversation

@matthiasgeihs

Copy link
Copy Markdown
Contributor

Summary

  • Stop storing the short-lived accessToken JWT in the seedless vault. The vault now holds TOPRF keys and revokeToken only; accessToken stays in memory and is refreshed from refreshToken when missing or near expiry, including while locked.
  • rotateRefreshToken revokes the previous refresh pair immediately after a successful vault write, and only queues it in pendingToBeRevokedTokens if revocation fails.
  • getIsUserAuthenticated no longer requires accessToken in state (social-auth details + revokeToken are enough for vault creation).

Test plan

  • yarn workspace @metamask/seedless-onboarding-controller run test
  • Unlock / lock / restart: getAccessToken still works while locked and after a process restart (missing token triggers refresh)
  • Create backup / change password: vault decrypts and does not contain accessToken
  • Refresh tokens while unlocked: old refresh token is revoked immediately; pending list stays empty unless revoke fails
  • Existing vaults that still contain accessToken continue to unlock (legacy extra field is ignored)

Made with Cursor

matthiasgeihs and others added 2 commits August 16, 2026 16:47
… vault

Cache the short-lived JWT in memory and refresh it from refreshToken when
missing or near expiry, including while locked. Revoke the previous refresh
pair immediately after a successful rotation instead of waiting on the client.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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