Fixes import & export with new encryption
This commit is contained in:
parent
1b0f6836dc
commit
35bab383b0
12 changed files with 86 additions and 67 deletions
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var BackupService = function(notification) {
|
||||
var BackupService = function($rootScope, notification, cryptoUtils) {
|
||||
this.$rootScope = $rootScope;
|
||||
this.notifications = notification;
|
||||
this.cryptoUtils = cryptoUtils;
|
||||
};
|
||||
|
||||
BackupService.prototype.getCopayer = function(wallet) {
|
||||
|
|
@ -40,11 +41,11 @@ BackupService.prototype._download = function(ew, walletName, filename) {
|
|||
};
|
||||
|
||||
BackupService.prototype.walletEncrypted = function(wallet) {
|
||||
return wallet.toEncryptedObj();
|
||||
return wallet.exportEncrypted(this.$rootScope.iden.password);
|
||||
}
|
||||
|
||||
BackupService.prototype.walletDownload = function(wallet) {
|
||||
var ew = wallet.toEncryptedObj();
|
||||
var ew = this.walletEncrypted(wallet);
|
||||
var walletName = wallet.getName();
|
||||
var copayerName = this.getCopayer(wallet);
|
||||
var filename = (copayerName ? copayerName + '-' : '') + walletName + '-keybackup.json.aes';
|
||||
|
|
@ -52,17 +53,14 @@ BackupService.prototype.walletDownload = function(wallet) {
|
|||
};
|
||||
|
||||
BackupService.prototype.profileEncrypted = function(iden) {
|
||||
return iden.toEncryptedObj();
|
||||
return iden.exportEncryptedWithWalletInfo(iden.password);
|
||||
}
|
||||
|
||||
BackupService.prototype.profileDownload = function(iden) {
|
||||
var ew = iden.toEncryptedObj();
|
||||
var name = iden.profile.getName();
|
||||
var ew = this.profileEncrypted(iden);
|
||||
var name = iden.fullName;
|
||||
var filename = name + '-profile.json';
|
||||
this._download(ew, name, filename)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
angular.module('copayApp.services').service('backupService', BackupService);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue