Fixes import & export with new encryption

This commit is contained in:
Esteban Ordano 2014-10-28 00:31:30 -03:00
commit 35bab383b0
12 changed files with 86 additions and 67 deletions

View file

@ -6,6 +6,7 @@ var preconditions = require('preconditions').singleton();
var inherits = require('inherits');
var events = require('events');
var async = require('async');
var cryptoUtil = require('../util/crypto');
var bitcore = require('bitcore');
var bignum = bitcore.Bignum;
@ -683,7 +684,6 @@ Wallet.prototype.getNetworkName = function() {
};
/**
* @desc
* @return {bool}
*/
Wallet.prototype.isTestnet = function() {
@ -2864,4 +2864,11 @@ Wallet.prototype.getTransactionHistory = function(cb) {
}
};
Wallet.prototype.exportEncrypted = function(password, opts) {
opts = opts || {};
var crypto = opts.cryptoUtil || cryptoUtil;
var key = crypto.kdf(password);
return crypto.encrypt(key, this.toObj());
};
module.exports = Wallet;