Browse Source

export privKeys in WIF

activeAddress
Ivan Socolsky 10 years ago
parent
commit
5b5aca9970
  1. 5
      lib/client/credentials.js
  2. 6
      test/integration/client.js

5
lib/client/credentials.js

@ -123,7 +123,10 @@ Credentials.prototype.exportCompressed = function() {
var self = this;
var values = _.map(EXPORTABLE_FIELDS, function(field) {
if ((field == 'xPubKey' || field == 'requestPrivKey') && self.canSign()) return;
if ((field == 'xPubKey' || field == 'requestPrivKey') && self.canSign()) return '';
if (field == 'requestPrivKey') {
return Bitcore.PrivateKey.fromString(self.requestPrivKey).toWIF();
}
if (field == 'publicKeyRing') {
return _.without(self.publicKeyRing, self.xPubKey);
}

6
test/integration/client.js

@ -915,9 +915,13 @@ describe('client API ', function() {
importedClient.credentials.copayerName.should.equal(copayerName);
});
it('should export & import encrypted', function() {
var xPrivKey = clients[0].credentials.xPrivKey;
should.exist(xPrivKey);
var exported = clients[0].export({
password: '123'
});
exported.should.not.contain(xPrivKey);
importedClient = new Client({
request: helpers.getRequest(app),
@ -925,6 +929,8 @@ describe('client API ', function() {
importedClient.import(exported, {
password: '123'
});
should.exist(importedClient.credentials.xPrivKey);
importedClient.credentials.xPrivKey.should.equal(xPrivKey);
});
it('should export & import compressed & encrypted', function() {
var exported = clients[0].export({

Loading…
Cancel
Save