export backup without signing capabilities

This commit is contained in:
Matias Alejo Garcia 2015-07-15 22:10:59 -03:00
commit bddfa5c4d9
7 changed files with 88 additions and 9 deletions

View file

@ -53,13 +53,14 @@ angular.module('copayApp.services')
return cb();
};
root.walletExport = function(password) {
root.walletExport = function(password, opts) {
if (!password) {
return null;
}
var fc = profileService.focusedClient;
try {
var b = fc.export({});
opts = opts || {};
var b = fc.export(opts);
var e = sjcl.encrypt(password, b, {
iter: 10000
});
@ -70,12 +71,13 @@ angular.module('copayApp.services')
};
};
root.walletDownload = function(password, cb) {
root.walletDownload = function(password, opts, cb) {
var fc = profileService.focusedClient;
var ew = root.walletExport(password);
var ew = root.walletExport(password, opts);
if (!ew) return cb('Could not create backup');
var walletName = (fc.alias || '') + (fc.alias ? '-' : '') + fc.credentials.walletName;
if (opts.noSign) walletName = walletName + '-noSign'
var filename = walletName + '-Copaybackup.aes.json';
_download(ew, filename, cb)
};