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/lib/idStore-migrator.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/idStore-migrator.js b/app/scripts/lib/idStore-migrator.js index c81e7ddfe..2d1826641 100644 --- a/app/scripts/lib/idStore-migrator.js +++ b/app/scripts/lib/idStore-migrator.js @@ -5,12 +5,21 @@ module.exports = class IdentityStoreMigrator { constructor ({ configManager }) { this.configManager = configManager - this.idStore = new IdentityStore({ configManager }) + const hasOldVault = this.hasOldVault() + if (!hasOldVault) { + this.idStore = new IdentityStore({ configManager }) + } } oldSeedForPassword( password ) { - const isOldVault = this.hasOldVault() - if (!isOldVault) { + const hasOldVault = this.hasOldVault() + const configManager = this.configManager + + if (!this.idStore) { + this.idStore = new IdentityStore({ configManager }) + } + + if (!hasOldVault) { return Promise.resolve(null) } -- cgit v1.2.3