aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/keyrings
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-03 06:04:50 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-03 06:04:50 +0800
commit4cf1b606e46fa735263b5e1fade5910b572335e3 (patch)
treeca0ca5ae19d0699002877cd26e14f84a207d4f4d /app/scripts/keyrings
parent8f3db0dbc0bafdc604bd7359bd41370f594c792c (diff)
downloadtangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.gz
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.zst
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.zip
Fix handling of migrating old vault style
Now old vaults are recognized as an "Initialized" MetaMask instance. Upon logging in, when fetching the initial password-derived key, if there is no new-style vault, but there is an old style vault, it is migrated to the new format before proceeding through the usual unlocking steps.
Diffstat (limited to 'app/scripts/keyrings')
-rw-r--r--app/scripts/keyrings/hd.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/scripts/keyrings/hd.js b/app/scripts/keyrings/hd.js
index 90052d9e7..d0ebee419 100644
--- a/app/scripts/keyrings/hd.js
+++ b/app/scripts/keyrings/hd.js
@@ -16,11 +16,11 @@ module.exports = class HdKeyring extends EventEmitter {
constructor(opts = {}) {
super()
this.type = type
- this.opts = opts || {}
this.deserialize(opts)
}
- deserialize(opts) {
+ deserialize(opts = {}) {
+ this.opts = opts || {}
this.wallets = []
this.mnemonic = null
this.root = null
@@ -32,12 +32,11 @@ module.exports = class HdKeyring extends EventEmitter {
if ('n' in opts) {
this.addAccounts(opts.n)
}
-
}
initFromMnemonic(mnemonic) {
- const seed = bip39.mnemonicToSeed(mnemonic)
this.mnemonic = mnemonic
+ const seed = bip39.mnemonicToSeed(mnemonic)
this.hdWallet = hdkey.fromMasterSeed(seed)
this.root = this.hdWallet.derivePath(hdPathString)
}