aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-10-21 01:28:45 +0800
committerDan Finlay <dan@danfinlay.com>2016-10-21 01:28:45 +0800
commit2132477797660a87fec20dbc0a3f839895b23309 (patch)
tree7fe8130dfbeccb5b643c7a34e9355f01395212d9 /app/scripts
parentf090828f9967b53bf73b21c3f59e1d15816f86a6 (diff)
downloadtangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar.gz
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar.bz2
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar.lz
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar.xz
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.tar.zst
tangerine-wallet-browser-2132477797660a87fec20dbc0a3f839895b23309.zip
Fix unlock logic
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/keyring-controller.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index db7e5e61e..416d6093c 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -45,7 +45,7 @@ module.exports = class KeyringController extends EventEmitter {
getState() {
return {
- isInitialized: !!this.key,
+ isInitialized: !!this.configManager.getVault(),
isUnlocked: !!this.key,
isConfirmed: true, // this.configManager.getConfirmed(),
isEthConfirmed: this.configManager.getShouldntShowWarning(),
@@ -66,9 +66,8 @@ module.exports = class KeyringController extends EventEmitter {
}
createNewVault(password, entropy, cb) {
- encryptor.keyFromPassword(password)
+ this.loadKey(password)
.then((key) => {
- this.key = key
return encryptor.encryptWithKey(key, {})
})
.then((encryptedString) => {
@@ -80,10 +79,22 @@ module.exports = class KeyringController extends EventEmitter {
})
}
-
-
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) {