store iterations in Storage
This commit is contained in:
parent
aa9f16a7e9
commit
47ae3fcb19
5 changed files with 18 additions and 7 deletions
|
|
@ -332,6 +332,10 @@ Identity.prototype.closeWallet = function(wid, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Identity.prototype.toObj = function(wid, cb) {
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desc This method prepares options for a new Wallet
|
* @desc This method prepares options for a new Wallet
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@ Insight.prototype.subscribe = function(addresses) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function handlerFor(self, address) {
|
function handlerFor(self, address) {
|
||||||
|
console.log('HANDLER [Insight.js.150:address:]',address); //TODO
|
||||||
return function(txid) {
|
return function(txid) {
|
||||||
// verify the address is still subscribed
|
// verify the address is still subscribed
|
||||||
if (!self.subscribed[address]) return;
|
if (!self.subscribed[address]) return;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ function Passphrase(config) {
|
||||||
preconditions.checkArgument(!config || !config.iterations || _.isNumber(config.iterations));
|
preconditions.checkArgument(!config || !config.iterations || _.isNumber(config.iterations));
|
||||||
config = config || {};
|
config = config || {};
|
||||||
this.salt = config.salt || 'mjuBtGybi/4=';
|
this.salt = config.salt || 'mjuBtGybi/4=';
|
||||||
this.iterations = config.iterations || 1000;
|
this.iterations = config.iterations;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,10 @@ Storage.prototype.savePassphrase = function() {
|
||||||
throw new Error('NOPASSPHRASE: No passphrase set');
|
throw new Error('NOPASSPHRASE: No passphrase set');
|
||||||
|
|
||||||
this.savedPassphrase = this.savedPassphrase || {};
|
this.savedPassphrase = this.savedPassphrase || {};
|
||||||
this.savedPassphrase[this.__uniqueid] = pps[this.__uniqueid];
|
this.savedPassphrase[this.__uniqueid] = {
|
||||||
|
pps: pps[this.__uniqueid],
|
||||||
|
iterations: this.iterations,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,7 +63,7 @@ Storage.prototype.restorePassphrase = function() {
|
||||||
if (!this.savedPassphrase[this.__uniqueid])
|
if (!this.savedPassphrase[this.__uniqueid])
|
||||||
throw new Error('NOSTOREDPASSPHRASE: No stored passphrase');
|
throw new Error('NOSTOREDPASSPHRASE: No stored passphrase');
|
||||||
|
|
||||||
pps[this.__uniqueid] = this.savedPassphrase[this.__uniqueid];
|
this._setPassphrase(this.savedPassphrase[this.__uniqueid].pps, this.savedPassphrase[this.__uniqueid].iterations);
|
||||||
this.savedPassphrase[this.__uniqueid] = undefined;
|
this.savedPassphrase[this.__uniqueid] = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -69,15 +72,16 @@ Storage.prototype.hasPassphrase = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Storage.prototype._setPassphrase = function(passphrase) {
|
Storage.prototype._setPassphrase = function(passphrase, iterations) {
|
||||||
pps[this.__uniqueid] = passphrase;
|
pps[this.__uniqueid] = passphrase;
|
||||||
|
this.iterations = iterations;
|
||||||
};
|
};
|
||||||
|
|
||||||
Storage.prototype.setPassword = function(password, config) {
|
Storage.prototype.setPassword = function(password, config) {
|
||||||
var passphraseConfig = _.extend(this.passphraseConfig, config);
|
var passphraseConfig = _.extend(this.passphraseConfig, config);
|
||||||
var p = new Passphrase(passphraseConfig);
|
var p = new Passphrase(passphraseConfig);
|
||||||
log.debug('Setting passphrase... Iterations:' + (passphraseConfig.iterations || 'default'))
|
log.debug('Setting passphrase... Iterations:' + passphraseConfig.iterations);
|
||||||
this._setPassphrase(p.getBase64(password));
|
this._setPassphrase(p.getBase64(password), passphraseConfig.iterations);
|
||||||
log.debug('done.')
|
log.debug('done.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,10 @@ angular.module('copayApp.services')
|
||||||
preconditions.checkState(w && _.isObject(w));
|
preconditions.checkState(w && _.isObject(w));
|
||||||
|
|
||||||
$rootScope.wallet = w;
|
$rootScope.wallet = w;
|
||||||
root.updateTxsAndBalance();
|
|
||||||
root.redirIfLogged();
|
root.redirIfLogged();
|
||||||
|
root.updateBalance(w, function() {
|
||||||
|
$rootScope.$digest();
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
root.bindProfile = function($scope, iden, w) {
|
root.bindProfile = function($scope, iden, w) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue