diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-10-20 05:55:08 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-10-20 05:55:08 +0800 |
commit | ad3fa24a28c0ec45dca43a257005626a4027487a (patch) | |
tree | eafbf105e0a2e5caf70fcf542b018c444705335f /app/scripts/keyring-controller.js | |
parent | 725d503f68f533e0d1dfc402c4316dcf677c0d89 (diff) | |
download | tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar.gz tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar.bz2 tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar.lz tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar.xz tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.tar.zst tangerine-wallet-browser-ad3fa24a28c0ec45dca43a257005626a4027487a.zip |
Intermediary commit.
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r-- | app/scripts/keyring-controller.js | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 246a45484..db7e5e61e 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -1,5 +1,7 @@ -const configManager = require('./lib/config-manager') const EventEmitter = require('events').EventEmitter +const encryptor = require('./lib/encryptor') +const messageManager = require('./lib/message-manager') + module.exports = class KeyringController extends EventEmitter { @@ -20,7 +22,7 @@ module.exports = class KeyringController extends EventEmitter { if (!salt) { salt = generateSalt(32) - configManager.setSalt(salt) + this.configManager.setSalt(salt) } var logN = 14 @@ -42,7 +44,21 @@ module.exports = class KeyringController extends EventEmitter { } getState() { - return {} + return { + isInitialized: !!this.key, + isUnlocked: !!this.key, + isConfirmed: true, // this.configManager.getConfirmed(), + isEthConfirmed: this.configManager.getShouldntShowWarning(), + unconfTxs: this.configManager.unconfirmedTxs(), + transactions: this.configManager.getTxList(), + unconfMsgs: messageManager.unconfirmedMsgs(), + messages: messageManager.getMsgList(), + selectedAddress: this.configManager.getSelectedAccount(), + shapeShiftTxList: this.configManager.getShapeShiftTxList(), + currentFiat: this.configManager.getCurrentFiat(), + conversionRate: this.configManager.getConversionRate(), + conversionDate: this.configManager.getConversionDate(), + } } setStore(ethStore) { @@ -50,9 +66,22 @@ module.exports = class KeyringController extends EventEmitter { } createNewVault(password, entropy, cb) { - cb() + encryptor.keyFromPassword(password) + .then((key) => { + this.key = key + return encryptor.encryptWithKey(key, {}) + }) + .then((encryptedString) => { + this.configManager.setVault(encryptedString) + cb(null, []) + }) + .catch((err) => { + cb(err) + }) } + + submitPassword(password, cb) { cb() } |