This commit is contained in:
Ivan Socolsky 2014-09-12 10:40:47 -03:00
commit 81a73e6f2a
5 changed files with 51 additions and 12 deletions

View file

@ -632,6 +632,14 @@ Wallet.prototype.getMyCopayerIdPriv = function() {
return this.privateKey.getIdPriv(); //copayer idpriv is hex of a private key
};
/**
* @desc Get my own nickname
* @return {string} copayer nickname
*/
Wallet.prototype.getMyCopayerNickname = function() {
return this.publicKeyRing.nicknameForCopayer(this.getMyCopayerId());
};
/**
* @desc Returns the secret value for other users to join this wallet
* @return {string} my own pubkey, base58 encoded

View file

@ -9,14 +9,17 @@ BackupService.prototype.getName = function(wallet) {
return (wallet.name ? (wallet.name + '-') : '') + wallet.id;
};
BackupService.prototype.getCopayer = function(wallet) {
return wallet.getMyCopayerNickname();
};
BackupService.prototype.download = function(wallet) {
var ew = wallet.toEncryptedObj();
var partial = !wallet.publicKeyRing.isComplete();
var walletName = this.getName(wallet) + (partial ? '-Partial' : '');
var filename = walletName + '-keybackup.json.aes';
var walletName = this.getName(wallet);
var copayerName = this.getCopayer(wallet);
var filename = copayerName + '-' + walletName + '-keybackup.json.aes';
var notify = partial ? 'Partial backup created' : 'Backup created';
this.notifications.success(notify, 'Encrypted backup file saved.');
this.notifications.success('Backup created', 'Encrypted backup file saved.');
var blob = new Blob([ew], {
type: 'text/plain;charset=utf-8'
});
@ -32,9 +35,8 @@ BackupService.prototype.download = function(wallet) {
// throw an email intent if we are in the mobile version
if (window.cordova) {
var name = wallet.name ? wallet.name + ' ' : '';
var partial = partial ? 'Partial ' : '';
return window.plugin.email.open({
subject: 'Copay - ' + name + 'Wallet ' + partial + 'Backup',
subject: 'Copay - ' + name + 'Wallet ' + 'Backup',
body: 'Here is the encrypted backup of the wallet ' + wallet.id,
attachments: ['base64:' + filename + '//' + btoa(ew)]
});