aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorCsaba Solya <csaba.solya@gmail.com>2018-03-03 07:32:57 +0800
committerCsaba Solya <csaba.solya@gmail.com>2018-03-03 07:32:57 +0800
commit92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad (patch)
treed430911e722a580ffa7d282c59a8a94554a2feb1 /app/scripts/metamask-controller.js
parentf22dfd4ae8031e3f7b4972a1cc8f119b99007717 (diff)
downloadtangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar.gz
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar.bz2
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar.lz
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar.xz
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.tar.zst
tangerine-wallet-browser-92453f8715b78c0e6e2cdb9b2e1cfe48c0b013ad.zip
seed phrase verifier
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index ad4e71792..89bcbd51b 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -37,6 +37,7 @@ const version = require('../manifest.json').version
const BN = require('ethereumjs-util').BN
const GWEI_BN = new BN('1000000000')
const percentile = require('percentile')
+const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
module.exports = class MetamaskController extends EventEmitter {
@@ -592,8 +593,23 @@ module.exports = class MetamaskController extends EventEmitter {
primaryKeyring.serialize()
.then((serialized) => {
const seedWords = serialized.mnemonic
- this.configManager.setSeedWords(seedWords)
- cb(null, seedWords)
+
+ primaryKeyring.getAccounts()
+ .then((accounts) => {
+ if (accounts.length < 1) {
+ return cb(new Error('MetamaskController - No accounts found'))
+ }
+
+ seedPhraseVerifier.verifyAccounts(accounts, seedWords)
+ .then(() => {
+ this.configManager.setSeedWords(seedWords)
+ cb(null, seedWords)
+ })
+ .catch((err) => {
+ log.error(err)
+ cb(err)
+ })
+ })
})
}