From 4cf1b606e46fa735263b5e1fade5910b572335e3 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 2 Nov 2016 15:04:50 -0700 Subject: 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. --- app/scripts/keyrings/hd.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/scripts/keyrings/hd.js') 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) } -- cgit v1.2.3