diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-12-22 09:21:10 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-12-22 09:21:10 +0800 |
commit | ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1 (patch) | |
tree | d27efd999dc02b84d077847150e5815ac481d50a /app/scripts/lib | |
parent | a3a64afdd5b2ed6bbed8c8dba5cc0f14d4a1ad99 (diff) | |
download | tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar.gz tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar.bz2 tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar.lz tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar.xz tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.tar.zst tangerine-wallet-browser-ebeaf3b3d6cf79e2e0f251b9b2da765f0fe6d0e1.zip |
Restructured migration
Migrator now returns a lostAccount array that includes objects
these objects include keys of address and privateKey,
this allows the MetamaskController to restore the lost accounts
even without customizing the idStore or the KeyringController.
Also includes a patch that allows idStore to synchronously export private keys.
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/idStore-migrator.js | 7 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/scripts/lib/idStore-migrator.js b/app/scripts/lib/idStore-migrator.js index 2e9418376..655aed0af 100644 --- a/app/scripts/lib/idStore-migrator.js +++ b/app/scripts/lib/idStore-migrator.js @@ -63,7 +63,12 @@ module.exports = class IdentityStoreMigrator { return { serialized, - lostAccounts, + lostAccounts: lostAccounts.map((address) => { + return { + address, + privateKey: this.idStore.exportAccount(address), + } + }), } }) } diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index cf4353e48..66e5d966c 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -202,7 +202,8 @@ IdentityStore.prototype.submitPassword = function (password, cb) { IdentityStore.prototype.exportAccount = function (address, cb) { var privateKey = this._idmgmt.exportPrivateKey(address) - cb(null, privateKey) + if (cb) cb(null, privateKey) + return privateKey } // |