mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix unlock logic
This commit is contained in:
parent
f090828f99
commit
2132477797
@ -45,7 +45,7 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
|
|
||||||
getState() {
|
getState() {
|
||||||
return {
|
return {
|
||||||
isInitialized: !!this.key,
|
isInitialized: !!this.configManager.getVault(),
|
||||||
isUnlocked: !!this.key,
|
isUnlocked: !!this.key,
|
||||||
isConfirmed: true, // this.configManager.getConfirmed(),
|
isConfirmed: true, // this.configManager.getConfirmed(),
|
||||||
isEthConfirmed: this.configManager.getShouldntShowWarning(),
|
isEthConfirmed: this.configManager.getShouldntShowWarning(),
|
||||||
@ -66,9 +66,8 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createNewVault(password, entropy, cb) {
|
createNewVault(password, entropy, cb) {
|
||||||
encryptor.keyFromPassword(password)
|
this.loadKey(password)
|
||||||
.then((key) => {
|
.then((key) => {
|
||||||
this.key = key
|
|
||||||
return encryptor.encryptWithKey(key, {})
|
return encryptor.encryptWithKey(key, {})
|
||||||
})
|
})
|
||||||
.then((encryptedString) => {
|
.then((encryptedString) => {
|
||||||
@ -80,10 +79,22 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
submitPassword(password, cb) {
|
submitPassword(password, cb) {
|
||||||
cb()
|
this.loadKey(password)
|
||||||
|
.then((key) => {
|
||||||
|
cb(null, [])
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
cb(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
loadKey(password) {
|
||||||
|
return encryptor.keyFromPassword(password)
|
||||||
|
.then((key) => {
|
||||||
|
this.key = key
|
||||||
|
return key
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedAddress(address, cb) {
|
setSelectedAddress(address, cb) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user