aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorCsaba Solya <csaba.solya@gmail.com>2018-03-04 05:08:10 +0800
committerCsaba Solya <csaba.solya@gmail.com>2018-03-04 05:08:10 +0800
commit2b86d65d0c3266e8ddfe814abe1d1755fbf23fda (patch)
treedee77324280c5787c8d2702d7db1d743743c55b9 /app/scripts
parent3e05b693dbf55ea7ecb791e8f31b7599a6b89ffd (diff)
downloadtangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar.gz
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar.bz2
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar.lz
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar.xz
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.tar.zst
tangerine-wallet-browser-2b86d65d0c3266e8ddfe814abe1d1755fbf23fda.zip
verify seedwords on log in
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/metamask-controller.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index b9231aa3d..df9adc248 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -345,6 +345,7 @@ module.exports = class MetamaskController extends EventEmitter {
// primary HD keyring management
addNewAccount: nodeify(this.addNewAccount, this),
placeSeedWords: this.placeSeedWords.bind(this),
+ verifySeedPhrase: this.verifySeedPhrase.bind(this),
clearSeedWordCache: this.clearSeedWordCache.bind(this),
resetAccount: this.resetAccount.bind(this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
@@ -588,6 +589,19 @@ module.exports = class MetamaskController extends EventEmitter {
// Used when creating a first vault, to allow confirmation.
// Also used when revealing the seed words in the confirmation view.
placeSeedWords (cb) {
+
+ this.verifySeedPhrase((err, seedWords) => {
+
+ if (err) {
+ return cb(err)
+ }
+ this.configManager.setSeedWords(seedWords)
+ return cb(null, seedWords)
+ })
+ }
+
+ verifySeedPhrase (cb) {
+
const primaryKeyring = this.keyringController.getKeyringsByType('HD Key Tree')[0]
if (!primaryKeyring) return cb(new Error('MetamaskController - No HD Key Tree found'))
primaryKeyring.serialize()
@@ -602,12 +616,11 @@ module.exports = class MetamaskController extends EventEmitter {
seedPhraseVerifier.verifyAccounts(accounts, seedWords)
.then(() => {
- this.configManager.setSeedWords(seedWords)
- cb(null, seedWords)
+ return cb(null, seedWords)
})
.catch((err) => {
log.error(err)
- cb(err)
+ return cb(err)
})
})
})