aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/keyring-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r--app/scripts/keyring-controller.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index e7b9612bf..ee6445121 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -47,6 +47,7 @@ module.exports = class KeyringController extends EventEmitter {
getState() {
return {
+ seedWords: this.configManager.getSeedWords(),
isInitialized: !!this.configManager.getVault(),
isUnlocked: !!this.key,
isConfirmed: true, // AUDIT this.configManager.getConfirmed(),
@@ -90,10 +91,14 @@ module.exports = class KeyringController extends EventEmitter {
this.configManager.setVault(encryptedString)
if (!serialized) {
- // TEMPORARY SINGLE-KEYRING CONFIG:
- return this.addNewKeyring('HD Key Tree', null, (err, newState) => {
- const firstAccount = this.keyrings[0].getAccounts()[0]
- autoFaucet(ethUtil.addHexPrefix(firstAccount))
+ this.addNewKeyring('HD Key Tree', null, (err, newState) => {
+ const firstKeyring = this.keyrings[0]
+ const firstAccount = firstKeyring.getAccounts()[0]
+ const hexAccount = ethUtil.addHexPrefix(firstAccount)
+ const seedWords = firstKeyring.serialize().mnemonic
+ this.configManager.setSelectedAccount(hexAccount)
+ this.configManager.setSeedWords(seedWords)
+ autoFaucet(hexAccount)
cb(err, newState)
})
} else {
@@ -470,6 +475,11 @@ module.exports = class KeyringController extends EventEmitter {
return ethUtil.addHexPrefix(result.toString(16))
}
+ clearSeedWordCache(cb) {
+ this.configManager.setSeedWords(null)
+ cb(null, this.configManager.getSelectedAccount())
+ }
+
}
function noop () {}