add store/restore passphrasse methods
This commit is contained in:
parent
d9cd2e95d4
commit
f1ae8f9c33
5 changed files with 32 additions and 7 deletions
|
|
@ -295,14 +295,17 @@ Identity.prototype.close = function(cb) {
|
|||
* @return {Wallet}
|
||||
*/
|
||||
Identity.prototype.importWallet = function(base64, password, skipFields, cb) {
|
||||
preconditions.checkArgument(password);
|
||||
preconditions.checkArgument(cb);
|
||||
|
||||
this.storage.savePassphrase();
|
||||
this.storage.setPassword(password);
|
||||
|
||||
var obj = this.storage.decrypt(base64);
|
||||
if (!obj) return false;
|
||||
this.storage.restorePassphrase();
|
||||
|
||||
if (!obj) return false;
|
||||
var w = Identity._walletFromObj(obj, this.storage, this.networkOpts, this.blockchainOpts);
|
||||
console.log('[Identity.js.307:Identity:]',w); //TODO
|
||||
this._checkVersion(w.version);
|
||||
this.addWallet(w, function(err) {
|
||||
if (err) return cb(err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue