Merge pull request #2998 from matiu/feat/nosign-backup
export backup without signing capabilities
This commit is contained in:
commit
d446c9facf
8 changed files with 96 additions and 11 deletions
|
|
@ -11,7 +11,15 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
this.isEncrypted = fc.isPrivKeyEncrypted();
|
||||
|
||||
this.downloadWalletBackup = function() {
|
||||
backupService.walletDownload(this.password, function() {
|
||||
var self = this;
|
||||
var opts = {
|
||||
noSign: $scope.noSign,
|
||||
};
|
||||
backupService.walletDownload(this.password, opts, function(err) {
|
||||
if (err) {
|
||||
self.error = true;
|
||||
return ;
|
||||
}
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
notification.success(gettext('Backup created'), gettext('Encrypted backup file saved'));
|
||||
go.walletHome();
|
||||
|
|
@ -19,19 +27,32 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
};
|
||||
|
||||
this.getBackup = function() {
|
||||
return backupService.walletExport(this.password);
|
||||
var opts = {
|
||||
noSign: $scope.noSign,
|
||||
};
|
||||
|
||||
var ew = backupService.walletExport(this.password, opts);
|
||||
if (!ew) {
|
||||
this.error = true;
|
||||
} else {
|
||||
this.error = false;
|
||||
}
|
||||
return ew;
|
||||
};
|
||||
|
||||
this.viewWalletBackup = function() {
|
||||
var self = this;
|
||||
$timeout(function() {
|
||||
self.backupWalletPlainText = self.getBackup();
|
||||
var ew = self.getBackup();
|
||||
if (!ew) return;
|
||||
self.backupWalletPlainText = ew;
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
}, 100);
|
||||
};
|
||||
|
||||
this.copyWalletBackup = function() {
|
||||
var ew = this.getBackup();
|
||||
if (!ew) return;
|
||||
window.cordova.plugins.clipboard.copy(ew);
|
||||
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
|
|
@ -48,6 +69,11 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
name = fc.alias + ' [' + name + ']';
|
||||
}
|
||||
var ew = this.getBackup();
|
||||
if (!ew) return;
|
||||
|
||||
if( $scope.noSign)
|
||||
name = name + '(No Private Key)';
|
||||
|
||||
var properties = {
|
||||
subject: 'Copay Wallet Backup: ' + name,
|
||||
body: 'Here is the encrypted backup of the wallet ' + name + ': \n\n' + ew + '\n\n To import this backup, copy all text between {...}, including the symbols {}',
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.walletName = fc.credentials.walletName;
|
||||
self.walletId = fc.credentials.walletId;
|
||||
self.isComplete = fc.isComplete();
|
||||
self.canSign = fc.canSign();
|
||||
self.txps = [];
|
||||
self.copayers = [];
|
||||
self.updateColor();
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.alternativeAmountStr = tx.alternativeAmountStr;
|
||||
$scope.copayers = copayers
|
||||
$scope.copayerId = fc.credentials.copayerId;
|
||||
$scope.canSign= fc.canSign();
|
||||
$scope.loading = null;
|
||||
$scope.color = fc.backgroundColor;
|
||||
refreshUntilItChanges = false;
|
||||
|
|
@ -229,6 +230,10 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
$scope.sign = function(txp) {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
if (!fc.canSign())
|
||||
return;
|
||||
|
||||
if (fc.isPrivKeyEncrypted()) {
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
|
|
@ -727,6 +732,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return self.setSendError(err);
|
||||
}
|
||||
|
||||
if (!fc.canSign()) {
|
||||
$log.info('No signing proposal: No private key')
|
||||
self.setOngoingProcess();
|
||||
self.resetForm();
|
||||
txStatus.notify(txp, function() {
|
||||
return $scope.$emit('Local/TxProposalAction');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
self.signAndBroadcast(txp, function(err) {
|
||||
self.setOngoingProcess();
|
||||
profileService.lockFC();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue