implementing passphrase to wallet Open/Create methods
This commit is contained in:
parent
8e0fbe589c
commit
8d4a6ded71
1 changed files with 5 additions and 3 deletions
|
|
@ -68,12 +68,13 @@ WalletFactory.prototype.fromObj = function(obj) {
|
||||||
return w;
|
return w;
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.read = function(walletId) {
|
WalletFactory.prototype.read = function(walletId, passphrase) {
|
||||||
if (! this._checkRead(walletId))
|
if (! this._checkRead(walletId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
var s = this.storage;
|
var s = this.storage;
|
||||||
|
s._setPassphrase(passphrase);
|
||||||
|
|
||||||
obj.id = walletId;
|
obj.id = walletId;
|
||||||
obj.opts = s.get(walletId, 'opts');
|
obj.opts = s.get(walletId, 'opts');
|
||||||
|
|
@ -86,7 +87,6 @@ WalletFactory.prototype.read = function(walletId) {
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.create = function(opts) {
|
WalletFactory.prototype.create = function(opts) {
|
||||||
var s = WalletFactory.storage;
|
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
this.log('### CREATING NEW WALLET.' +
|
this.log('### CREATING NEW WALLET.' +
|
||||||
(opts.id ? ' USING ID: ' + opts.id : ' NEW ID') +
|
(opts.id ? ' USING ID: ' + opts.id : ' NEW ID') +
|
||||||
|
|
@ -112,6 +112,8 @@ WalletFactory.prototype.create = function(opts) {
|
||||||
});
|
});
|
||||||
this.log('\t### TxProposals Initialized');
|
this.log('\t### TxProposals Initialized');
|
||||||
|
|
||||||
|
this.storage._setPassphrase(opts.passphrase);
|
||||||
|
|
||||||
opts.storage = this.storage;
|
opts.storage = this.storage;
|
||||||
opts.network = this.network;
|
opts.network = this.network;
|
||||||
opts.blockchain = this.blockchain;
|
opts.blockchain = this.blockchain;
|
||||||
|
|
@ -130,7 +132,7 @@ WalletFactory.prototype.open = function(walletId, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
opts.id = walletId;
|
opts.id = walletId;
|
||||||
opts.verbose = this.verbose;
|
opts.verbose = this.verbose;
|
||||||
var w = this.read(walletId) || this.create(opts);
|
var w = this.read(walletId, opts.passphrase) || this.create(opts);
|
||||||
w.store();
|
w.store();
|
||||||
return w;
|
return w;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue