This commit is contained in:
Matias Alejo Garcia 2014-10-21 09:57:54 -03:00
commit 39e85396db
7 changed files with 123 additions and 42 deletions

View file

@ -70,6 +70,25 @@ Profile.prototype.toObj = function() {
return _.clone(_.pick(this, 'hash', 'email', 'extra', 'walletInfos'));
};
/*
* @desc Return a base64 encrypted version of the wallet
* @return {string} base64 encoded string
*/
Profile.prototype.export = function() {
var profObj = this.toObj();
return this.storage.encrypt(profObj);
};
/*
* @desc Return a base64 encrypted version of the wallet
* @return {string} base64 encoded string
*/
Profile.import = function(str, password, storage) {
var obj = storage.decrypt(str,password)
return new Profile(obj, storage);
};
Profile.prototype.getWallet = function(walletId, cb) {
return this.walletInfos[walletId];
};