diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-06-03 08:28:27 +0800 |
---|---|---|
committer | kumavis <kumavis@users.noreply.github.com> | 2016-06-03 08:28:27 +0800 |
commit | 3b3c472dee5dcb349f955bf07de2efc069347f66 (patch) | |
tree | 126ec2da99a9b3f266b7fb0be67612faaef47e3b /app | |
parent | f8e6a5eaf0afcc711f41cc53f1d4225a5eea24d7 (diff) | |
parent | 10fec9052f2cd200868de25217bdaa4646fa0913 (diff) | |
download | tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar.gz tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar.bz2 tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar.lz tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar.xz tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.tar.zst tangerine-wallet-browser-3b3c472dee5dcb349f955bf07de2efc069347f66.zip |
Merge pull request #240 from MetaMask/RecoverSeed
reveal Vault Recovery Seed
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/background.js | 8 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index bfd1fc92b..432040c53 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -145,7 +145,7 @@ function setupPublicConfig(stream){ } function setupProviderConnection(stream, originDomain){ - + stream.on('data', function onRpcRequest(payload){ // Append origin to rpc payload payload.origin = originDomain @@ -195,6 +195,8 @@ function setupControllerConnection(stream){ exportAccount: idStore.exportAccount.bind(idStore), revealAccount: idStore.revealAccount.bind(idStore), saveAccountLabel: idStore.saveAccountLabel.bind(idStore), + tryPassword: idStore.tryPassword.bind(idStore), + recoverSeed: idStore.recoverSeed.bind(idStore), }) stream.pipe(dnode).pipe(stream) dnode.on('remote', function(remote){ @@ -246,7 +248,7 @@ function newUnsignedTransaction(txParams, cb){ }) var txId = idStore.addUnconfirmedTransaction(txParams, cb) } else { - addUnconfirmedTx(txParams, cb) + addUnconfirmedTx(txParams, cb) } } @@ -258,7 +260,7 @@ function newUnsignedMessage(msgParams, cb){ }) var msgId = idStore.addUnconfirmedMessage(msgParams, cb) } else { - addUnconfirmedMsg(msgParams, cb) + addUnconfirmedMsg(msgParams, cb) } } diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 4ce4fd6f2..e9fc10cea 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -59,6 +59,13 @@ IdentityStore.prototype.createNewVault = function(password, entropy, cb){ }) } +IdentityStore.prototype.recoverSeed = function(cb){ + configManager.setShowSeedWords(true) + if (!this._idmgmt) return cb(new Error('Unauthenticated. Please sign in.')) + var seedWords = this._idmgmt.getSeed() + cb(null, seedWords) +} + IdentityStore.prototype.recoverFromSeed = function(password, seed, cb){ this._createIdmgmt(password, seed, null, (err) => { if (err) return cb(err) @@ -150,7 +157,7 @@ IdentityStore.prototype.setLocked = function(cb){ } IdentityStore.prototype.submitPassword = function(password, cb){ - this._tryPassword(password, (err) => { + this.tryPassword(password, (err) => { if (err) return cb(err) // load identities before returning... this._loadIdentities() @@ -366,7 +373,7 @@ IdentityStore.prototype._mayBeFauceting = function(i) { // keyStore managment - unlocking + deserialization // -IdentityStore.prototype._tryPassword = function(password, cb){ +IdentityStore.prototype.tryPassword = function(password, cb){ this._createIdmgmt(password, null, null, cb) } |