add #addWallet to profile
This commit is contained in:
parent
77a01370cb
commit
7abdc77611
4 changed files with 91 additions and 42 deletions
|
|
@ -12,6 +12,7 @@ function Profile(info, password, storage) {
|
|||
|
||||
this.email = info.email;
|
||||
this.extra = info.extra;
|
||||
this.walletIds = {};
|
||||
this.hash = Profile.hash(this.email, password);
|
||||
this.storage = storage;
|
||||
};
|
||||
|
|
@ -44,6 +45,17 @@ Profile.open = function(storage, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
Profile.prototype.addWallet = function(walletId, cb) {
|
||||
if (this.walletIds[walletId])
|
||||
return cb(new Error('WEXIST: Wallet already on profile'));
|
||||
|
||||
this.walletIds[walletId] = Date.now();
|
||||
this.store({
|
||||
overwrite: true
|
||||
}, cb);
|
||||
};
|
||||
|
||||
Profile.prototype.store = function(opts, cb) {
|
||||
var self = this;
|
||||
var val = self.toObj();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue