diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-11-23 01:52:43 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-11-23 01:52:43 +0800 |
commit | 136296aad6058c4bea8c3083e8ae553b2afcab98 (patch) | |
tree | 636d5128800c1d507504051696cd0fae0ffd5110 | |
parent | ecfda5bcc54bc444f3620a18a561847d0d2634dd (diff) | |
download | tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar.gz tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar.bz2 tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar.lz tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar.xz tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.tar.zst tangerine-wallet-browser-136296aad6058c4bea8c3083e8ae553b2afcab98.zip |
Began moving salt into encryptor
-rw-r--r-- | app/scripts/keyring-controller.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index cf761c88c..e3705c113 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -55,7 +55,7 @@ module.exports = class KeyringController extends EventEmitter { return { seedWords: this.configManager.getSeedWords(), isInitialized: (!!wallet || !!vault), - isUnlocked: !!this.key, + isUnlocked: this.keyrings.length > 0, isDisclaimerConfirmed: this.configManager.getConfirmedDisclaimer(), // AUDIT this.configManager.getConfirmedDisclaimer(), unconfTxs: this.configManager.unconfirmedTxs(), transactions: this.configManager.getTxList(), @@ -137,7 +137,7 @@ module.exports = class KeyringController extends EventEmitter { createNewVault (password, entropy, cb) { const configManager = this.configManager - const salt = this.encryptor.generateSalt() + const salt = this.getSalt() configManager.setSalt(salt) return this.migrateAndGetKey(password) @@ -182,7 +182,7 @@ module.exports = class KeyringController extends EventEmitter { submitPassword (password, cb) { this.migrateAndGetKey(password) .then((key) => { - return this.unlockKeyrings(key) + return this.unlockKeyrings(password) }) .then((keyrings) => { this.keyrings = keyrings @@ -197,7 +197,7 @@ module.exports = class KeyringController extends EventEmitter { } loadKey (password) { - const salt = this.configManager.getSalt() || this.encryptor.generateSalt() + const salt = this.getSalt() return this.encryptor.keyFromPassword(password + salt) .then((key) => { this.key = key @@ -206,6 +206,11 @@ module.exports = class KeyringController extends EventEmitter { }) } + getSalt () { + const vault = this.configManager.getVault() + const salt = vault.salt || this.encryptor.generateSalt() + } + addNewKeyring (type, opts, cb) { const Keyring = this.getKeyringClassForType(type) const keyring = new Keyring(opts) @@ -288,7 +293,7 @@ module.exports = class KeyringController extends EventEmitter { }) } - unlockKeyrings (key) { + unlockKeyrings (password) { const encryptedVault = this.configManager.getVault() return this.encryptor.decryptWithKey(key, encryptedVault) .then((vault) => { |