From 230d43176d92c470260c9d86230355733eb97642 Mon Sep 17 00:00:00 2001 From: ryanml Date: Fri, 24 Jul 2020 15:47:40 -0700 Subject: [PATCH] Fixes MetaMask/metamask-extension#8626 - verifies password on requesting seed phrase (#9063) --- app/scripts/metamask-controller.js | 10 ++++++++++ package.json | 2 +- ui/app/store/actions.js | 4 ++-- yarn.lock | 8 ++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 3f1511333..5aa4539e3 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -478,6 +478,7 @@ export default class MetamaskController extends EventEmitter { // vault management submitPassword: nodeify(this.submitPassword, this), + verifyPassword: nodeify(this.verifyPassword, this), // network management setProviderType: nodeify(networkController.setProviderType, networkController), @@ -808,6 +809,15 @@ export default class MetamaskController extends EventEmitter { return this.keyringController.fullUpdate() } + /** + * Submits a user's password to check its validity. + * + * @param {string} password The user's password + */ + async verifyPassword (password) { + await this.keyringController.verifyPassword(password) + } + /** * @type Identity * @property {string} name - The account nickname. diff --git a/package.json b/package.json index d0b2a48b6..a433b99cd 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "eth-json-rpc-filters": "^4.1.1", "eth-json-rpc-infura": "^4.0.2", "eth-json-rpc-middleware": "^5.0.2", - "eth-keyring-controller": "^6.0.1", + "eth-keyring-controller": "^6.1.0", "eth-method-registry": "^1.2.0", "eth-phishing-detect": "^1.1.4", "eth-query": "^2.1.2", diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index abb855233..49a43da24 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -168,7 +168,7 @@ export function createNewVault (password) { export function verifyPassword (password) { return new Promise((resolve, reject) => { - background.submitPassword(password, (error) => { + background.verifyPassword(password, (error) => { if (error) { return reject(error) } @@ -193,7 +193,7 @@ export function verifySeedPhrase () { export function requestRevealSeedWords (password) { return async (dispatch) => { dispatch(showLoadingIndication()) - log.debug(`background.submitPassword`) + log.debug(`background.verifyPassword`) try { await verifyPassword(password) diff --git a/yarn.lock b/yarn.lock index 0290b9ac1..30f8e5ecf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10131,10 +10131,10 @@ eth-keyring-controller@^5.3.0, eth-keyring-controller@^5.6.1: loglevel "^1.5.0" obs-store "^4.0.3" -eth-keyring-controller@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-6.0.1.tgz#6a4cdd5802b0587320c711be6c1752b2a88221aa" - integrity sha512-60j71F1HgLcvwzg7U5R45bA/kgQSUlmiZrsUIIhW4qS7QOYqJn0OQ64enf0ZaxMMPVVcKSfCDersYJiqm/yrlw== +eth-keyring-controller@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-6.1.0.tgz#dc9313d0b793e085dc1badf84dd4f5e3004e127e" + integrity sha512-wPxH++98VDBcDv9YkPzxhZC0gF1ixuRbyKR2u/NOT/roBpNQDe4reqyllBRC7jhPehiKnRxzf7r6HEyirRnPxQ== dependencies: bip39 "^2.4.0" bluebird "^3.5.0"