-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[PM-6789] add legacy user key state #9274
Conversation
@MGibson1 I know we discussed moving out all the legacy code from the crypto service, but that ended up being quite the overhaul. Considering this should be the final step before removing all the legacy code, I wanted to throw this up as an option. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9274 +/- ##
==========================================
+ Coverage 27.91% 28.15% +0.23%
==========================================
Files 2356 2369 +13
Lines 69622 70034 +412
Branches 13117 13161 +44
==========================================
+ Hits 19435 19716 +281
- Misses 48647 48759 +112
- Partials 1540 1559 +19 ☔ View full report in Codecov by Sentry. |
New Issues
Fixed Issues
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth changes are good.
if (await this.isLegacyUser(null, userId)) { | ||
return await this.getUserKeyWithLegacySupport(userId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: please use master password service directly rather than this, which causes a weird cycle on activeUserKey$
.
I would just switch map a few times from user id -> master key -> async is legacy user with a function that returns the master key again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
if (await this.isLegacyUser(masterKey, userId)) { | ||
return masterKey; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just call validate -- you have all the data
What is returned if neither pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Good point, sure why not.
- We could return
userKey
(really whatever the state provider should give us if there was nouserKey
). TheuserKey
nullish check should happen before we check for legacy users. So we're not doing extra computation on every request.
Heads up, I am working on some changes right now that are actually going to get rid of |
@justindbaur That'd be awesome, can you add me on that PR? I can close this in favor of that one. |
Closing in favor of #9364 |
Type of change
Objective
When we migrated private keys to state providers, we didn't account for legacy user keys. Without being able to decrypt the private key using the legacy key (master key) we couldn't migrate the legacy users. This adds a
activeUserKeyWithLegacySupport$
observable to pass in the derived state so it can correctly decrypt the private key.Code changes
Screenshots
Before you submit