This commit is contained in:
Gabriel Bazán 2015-11-06 17:45:23 -03:00
commit 0d81cf8e9c
2 changed files with 17 additions and 3 deletions

View file

@ -53,6 +53,14 @@ angular.module('copayApp.services')
return cb();
};
root.addMetadata = function(b, opts) {
b = JSON.parse(b);
if (opts.historyCache) b.historyCache = opts.historyCache;
if (opts.addressBook) b.addressBook = opts.addressBook;
return JSON.stringify(b);
}
root.walletExport = function(password, opts) {
if (!password) {
return null;
@ -61,6 +69,8 @@ angular.module('copayApp.services')
try {
opts = opts || {};
var b = fc.export(opts);
if (opts.historyCache || opts.addressBook) b = root.addMetadata(b, opts);
var e = sjcl.encrypt(password, b, {
iter: 10000
});
@ -82,4 +92,4 @@ angular.module('copayApp.services')
_download(ew, filename, cb)
};
return root;
});
});