Storing the backup flag
This commit is contained in:
parent
d0c5e16865
commit
52fb680658
6 changed files with 34 additions and 98 deletions
|
|
@ -274,10 +274,17 @@ Identity.prototype.toObj = function() {
|
|||
|
||||
Identity.prototype.exportEncryptedWithWalletInfo = function(opts) {
|
||||
var crypto = opts.cryptoUtil || cryptoUtil;
|
||||
this.backupNeeded = false;
|
||||
|
||||
return crypto.encrypt(this.password, this.exportWithWalletInfo(opts));
|
||||
};
|
||||
|
||||
Identity.prototype.setBackupDone = function() {
|
||||
this.backupNeeded = false;
|
||||
this.store({
|
||||
noWallets: true
|
||||
}, function() {});
|
||||
}
|
||||
|
||||
Identity.prototype.exportWithWalletInfo = function(opts) {
|
||||
return _.extend({
|
||||
wallets: _.map(this.wallets, function(wallet) {
|
||||
|
|
@ -295,12 +302,13 @@ Identity.prototype.exportWithWalletInfo = function(opts) {
|
|||
Identity.prototype.store = function(opts, cb) {
|
||||
var self = this;
|
||||
opts = opts || {};
|
||||
opts.backupNeeded = false;
|
||||
|
||||
var storeFunction = opts.failIfExists ? self.storage.createItem : self.storage.setItem;
|
||||
|
||||
storeFunction.call(self.storage, this.getId(), this.toObj(), function(err) {
|
||||
if (err) return cb(err);
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (opts.noWallets)
|
||||
return cb();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue