|
|
@ -118,6 +118,7 @@ module.exports = class KeyringController extends EventEmitter { |
|
|
|
return this.idStoreMigrator.migratedVaultForPassword(password) |
|
|
|
return this.idStoreMigrator.migratedVaultForPassword(password) |
|
|
|
.then((serialized) => { |
|
|
|
.then((serialized) => { |
|
|
|
if (serialized && shouldMigrate) { |
|
|
|
if (serialized && shouldMigrate) { |
|
|
|
|
|
|
|
this.password = password |
|
|
|
const keyring = this.restoreKeyring(serialized) |
|
|
|
const keyring = this.restoreKeyring(serialized) |
|
|
|
this.keyrings.push(keyring) |
|
|
|
this.keyrings.push(keyring) |
|
|
|
this.configManager.setSelectedAccount(keyring.getAccounts()[0]) |
|
|
|
this.configManager.setSelectedAccount(keyring.getAccounts()[0]) |
|
|
@ -185,7 +186,6 @@ module.exports = class KeyringController extends EventEmitter { |
|
|
|
cb(null, this.getState()) |
|
|
|
cb(null, this.getState()) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
.catch((err) => { |
|
|
|
console.error(err) |
|
|
|
|
|
|
|
cb(err) |
|
|
|
cb(err) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
@ -274,8 +274,9 @@ module.exports = class KeyringController extends EventEmitter { |
|
|
|
|
|
|
|
|
|
|
|
unlockKeyrings (password) { |
|
|
|
unlockKeyrings (password) { |
|
|
|
const encryptedVault = this.configManager.getVault() |
|
|
|
const encryptedVault = this.configManager.getVault() |
|
|
|
return this.encryptor.decrypt(this.password, encryptedVault) |
|
|
|
return this.encryptor.decrypt(password, encryptedVault) |
|
|
|
.then((vault) => { |
|
|
|
.then((vault) => { |
|
|
|
|
|
|
|
this.password = password |
|
|
|
vault.forEach(this.restoreKeyring.bind(this)) |
|
|
|
vault.forEach(this.restoreKeyring.bind(this)) |
|
|
|
return this.keyrings |
|
|
|
return this.keyrings |
|
|
|
}) |
|
|
|
}) |
|
|
@ -557,7 +558,7 @@ module.exports = class KeyringController extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setLocked (cb) { |
|
|
|
setLocked (cb) { |
|
|
|
this.key = null |
|
|
|
this.password = null |
|
|
|
this.keyrings = [] |
|
|
|
this.keyrings = [] |
|
|
|
this.emit('update') |
|
|
|
this.emit('update') |
|
|
|
cb() |
|
|
|
cb() |
|
|
|