Merge pull request #596 from JDonadio/fix/import-with-pk-encrypted
Fix import wallet with pk encrypted
This commit is contained in:
commit
ff931ecb31
1 changed files with 10 additions and 8 deletions
|
|
@ -601,6 +601,16 @@ angular.module('copayApp.services')
|
||||||
$log.debug('Importing Wallet:', opts);
|
$log.debug('Importing Wallet:', opts);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
var c = JSON.parse(str);
|
||||||
|
|
||||||
|
if (c.xPrivKey && c.xPrivKeyEncrypted) {
|
||||||
|
$log.warn('Found both encrypted and decrypted key. Deleting the encrypted version');
|
||||||
|
delete c.xPrivKeyEncrypted;
|
||||||
|
delete c.mnemonicEncrypted;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = JSON.stringify(c);
|
||||||
|
|
||||||
walletClient.import(str, {
|
walletClient.import(str, {
|
||||||
compressed: opts.compressed,
|
compressed: opts.compressed,
|
||||||
password: opts.password
|
password: opts.password
|
||||||
|
|
@ -609,14 +619,6 @@ angular.module('copayApp.services')
|
||||||
return cb(gettext('Could not import. Check input file and spending password'));
|
return cb(gettext('Could not import. Check input file and spending password'));
|
||||||
}
|
}
|
||||||
|
|
||||||
str = JSON.parse(str);
|
|
||||||
|
|
||||||
if (str.xPrivKey && str.xPrivKeyEncrypted) {
|
|
||||||
$log.warn('Found both encrypted and decrypted key. Deleting the encrypted version');
|
|
||||||
delete str.xPrivKeyEncrypted;
|
|
||||||
delete str.mnemonicEncrypted;
|
|
||||||
}
|
|
||||||
|
|
||||||
var addressBook = str.addressBook || {};
|
var addressBook = str.addressBook || {};
|
||||||
|
|
||||||
addAndBindWalletClient(walletClient, {
|
addAndBindWalletClient(walletClient, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue