From 874d9c1ab825c5bd0b6b5d05d0136bb9b77b4638 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 6 Apr 2016 12:01:10 -0700 Subject: Add ability to export private keys --- app/scripts/background.js | 1 + app/scripts/lib/idStore.js | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'app') diff --git a/app/scripts/background.js b/app/scripts/background.js index 14293ab05..850a7bc6e 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -124,6 +124,7 @@ function linkDnode(stream){ cancelTransaction: idStore.cancelTransaction.bind(idStore), setLocked: idStore.setLocked.bind(idStore), clearSeedWordCache: idStore.clearSeedWordCache.bind(idStore), + exportAccount: idStore.exportAccount.bind(idStore), }) stream.pipe(connection).pipe(stream) connection.on('remote', function(remote){ diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 8ac5185db..f44300273 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -123,6 +123,11 @@ IdentityStore.prototype.submitPassword = function(password, cb){ }) } +IdentityStore.prototype.exportAccount = function(address, cb) { + var privateKey = this._idmgmt.exportPrivateKey(address) + cb(null, privateKey) +} + // comes from dapp via zero-client hooked-wallet provider IdentityStore.prototype.addUnconfirmedTransaction = function(txParams, cb){ @@ -337,6 +342,10 @@ function IdManagement(opts) { this.getSeed = function(){ return this.keyStore.getSeed(this.derivedKey) } + + this.exportPrivateKey = function(address) { + return this.keyStore.exportPrivateKey(address, this.derivedKey, this.hdPathString) + } } -- cgit