mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Promisify persistence of keyrings before returning key
Change single letter variables (shame)
This commit is contained in:
parent
c695d54b01
commit
bc6312e9e3
@ -127,8 +127,9 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
if (serialized && shouldMigrate) {
|
if (serialized && shouldMigrate) {
|
||||||
const keyring = this.restoreKeyring(serialized)
|
const keyring = this.restoreKeyring(serialized)
|
||||||
this.keyrings.push(keyring)
|
this.keyrings.push(keyring)
|
||||||
this.persistAllKeyrings()
|
|
||||||
this.configManager.setSelectedAccount(keyring.getAccounts()[0])
|
this.configManager.setSelectedAccount(keyring.getAccounts()[0])
|
||||||
|
return this.persistAllKeyrings()
|
||||||
|
.then(() => { return key })
|
||||||
}
|
}
|
||||||
return key
|
return key
|
||||||
})
|
})
|
||||||
@ -274,13 +275,12 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
persistAllKeyrings () {
|
persistAllKeyrings () {
|
||||||
const serialized = this.keyrings.map((k) => {
|
const serialized = this.keyrings.map((keyring) => {
|
||||||
return {
|
return {
|
||||||
type: k.type,
|
type: keyring.type,
|
||||||
data: k.serialize(),
|
data: keyring.serialize(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return this.encryptor.encryptWithKey(this.key, serialized)
|
return this.encryptor.encryptWithKey(this.key, serialized)
|
||||||
.then((encryptedString) => {
|
.then((encryptedString) => {
|
||||||
this.configManager.setVault(encryptedString)
|
this.configManager.setVault(encryptedString)
|
||||||
|
Loading…
Reference in New Issue
Block a user