mirror of https://github.com/BTCPrivate/copay.git
added encryption backup support
This commit is contained in:
parent
5b09440828
commit
c995f039c2
|
@ -268,6 +268,11 @@ Wallet.fromObj = function(o, storage, network, blockchain) {
|
|||
return w;
|
||||
};
|
||||
|
||||
Wallet.prototype.toEncryptedObj = function() {
|
||||
var walletObj = this.toObj();
|
||||
return this.storage.export(walletObj);
|
||||
};
|
||||
|
||||
Wallet.prototype.sendTxProposals = function(recipients) {
|
||||
this.log('### SENDING txProposals TO:', recipients || 'All', this.txProposals);
|
||||
|
||||
|
|
|
@ -68,6 +68,12 @@ WalletFactory.prototype.fromObj = function(obj) {
|
|||
return w;
|
||||
};
|
||||
|
||||
WalletFactory.prototype.fromEncryptedObj = function(base64, password) {
|
||||
this.storage._setPassphrase(password);
|
||||
var walletObj = this.storage.import(base64);
|
||||
return this.fromObj(walletObj);
|
||||
};
|
||||
|
||||
WalletFactory.prototype.read = function(walletId) {
|
||||
if (! this._checkRead(walletId))
|
||||
return false;
|
||||
|
|
|
@ -157,4 +157,14 @@ Storage.prototype.clearAll = function() {
|
|||
localStorage.clear();
|
||||
};
|
||||
|
||||
Storage.prototype.export = function(obj) {
|
||||
var encryptedObj = this._encryptObj(obj);
|
||||
return encryptedObj;
|
||||
};
|
||||
|
||||
Storage.prototype.import = function(base64) {
|
||||
var decryptedObj = this._decryptObj(base64);
|
||||
return decryptedObj;
|
||||
};
|
||||
|
||||
module.exports = require('soop')(Storage);
|
||||
|
|
Loading…
Reference in New Issue