aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
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/lib
parent8f3db0dbc0bafdc604bd7359bd41370f594c792c (diff)
downloadtangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.gz
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.bz2
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.lz
tangerine-wallet-browser-4cf1b606e46fa735263b5e1fade5910b572335e3.tar.xz
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/lib')
-rw-r--r--app/scripts/lib/idStore-migrator.js15
1 files changed, 12 insertions, 3 deletions
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)
}