Skip to content

Feat/seedless refresh token #5917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 220 commits into
base: main
Choose a base branch
from
Open

Feat/seedless refresh token #5917

wants to merge 220 commits into from

Conversation

tuna1207
Copy link
Member

@tuna1207 tuna1207 commented Jun 4, 2025

Explanation

Add refresh token and revoke refresh token handling to SeedlessOnboardingController

  • persist refresh token in state
  • store revoke token in vault
  • check for token expired in toprf call, refresh token and retry
  • revoke refresh token and replace with new one after password submit to prevent malicious use if refresh token leak in persisted state

References

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

lwin-kyaw and others added 30 commits April 10, 2025 12:40
…Mask/core into feat/seedless-onboarding-controller
@tuna1207 tuna1207 requested a review from a team as a code owner June 4, 2025 10:21
@tuna1207 tuna1207 requested a review from a team as a code owner June 4, 2025 10:24
@@ -109,6 +116,14 @@ const seedlessOnboardingMetadata: StateMetadata<SeedlessOnboardingControllerStat
persist: true,
anonymous: true,
},
refreshToken: {
persist: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should store the refreshToken in plain text

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go inside the vault? We can decrypt and get it whenever we want.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lwin-kyaw after discussing with @himanshuchawla009 we decided to go with this refresh token + revoke token approach since the checkIsPasswordOutdated call need to be checked when app is locked (vault is locked) so we need refreshToken outside vault
revokeToken is inside the vault and will be used to revoke refreshToken for new one (invalidate the old one) after user unlock the app

persist: true,
anonymous: true,
},
revokeToken: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go inside the vault, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

@lwin-kyaw this is only temporarily stored in state (not persisted) for subsequent call to store in vault createToprfKeyAndBackupSeedPhrase, fetchAllSeedPhrases after authenticate
it's also cleared from temp state when app locked

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.

4 participants