This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 134
fix keeping the wallet unlocked on sw restart after onboarding #203
Merged
pedronfigueiredo
merged 7 commits into
main
from
fix/keep-freshly-loaded-wallet-unlocked
Mar 6, 2023
Merged
fix keeping the wallet unlocked on sw restart after onboarding #203
pedronfigueiredo
merged 7 commits into
main
from
fix/keep-freshly-loaded-wallet-unlocked
Mar 6, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gudahtt
reviewed
Mar 3, 2023
Gudahtt
reviewed
Mar 3, 2023
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.
Looks great! Great to have these additional tests, but I think the code being changed here isn't yet adequately covered. I can approve once it's covered by at least one test
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Gudahtt
reviewed
Mar 3, 2023
Gudahtt
reviewed
Mar 3, 2023
Gudahtt
previously approved these changes
Mar 3, 2023
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.
LGTM! Left a comment on two tests that can still be improved
pedronfigueiredo
force-pushed
the
fix/keep-freshly-loaded-wallet-unlocked
branch
from
March 3, 2023 20:58
e33481e
to
b0a4300
Compare
brad-decker
approved these changes
Mar 6, 2023
8 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
We want to keep the wallet unlocked when a service worker restarts.
In
persistAllKeyrings
, when we're building for mv3 and want to cache theencryptionKey
but a password was entered and a newencryptionKey
has been generated, we want to saveencryptionSalt
alongside the newencryptionKey
in the keyring controllermemStore
.This is so it can be saved in storage and then retrieved on the metamask controller for the extension.
Note that this PR only fixes the first time the service worker is restarted after a fresh wallet is loaded and the onboarding flow is complete. Unlocked wallet persistence for subsequent service worker restarts has been fixed on a separate PR on the extension repository.
For context, this was previously addressed, but the wallet was still locked after a long enough waiting period after the service worker restarted. Another PR has since been merged, making the wallet lock more immediately apparent.
Manual Testing Steps
git checkout develop && git pull && yarn && yarn:start:mv3
Load the wallet in the browser and complete the onboarding flow
Terminate the service worker using
chrome://inspect/#service-workers
.The wallet should lock after a couple of seconds.
Add the changes on
index.js
on this PR to the corresponding file on thenode_modules
folder of the Metamask Extension.Build the wallet again.
Load the wallet in the browser and complete the onboarding flow
Terminate the service worker using
chrome://inspect/#service-workers
.The wallet should remain unlocked.
Pre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Board
label.In this case, a QA Engineer approval will be be required.