implement cache for key derivation, using user-agent
This commit is contained in:
parent
02861992e6
commit
d08d4e3650
4 changed files with 14 additions and 14 deletions
|
|
@ -66,7 +66,7 @@ angular.module('copayApp.services')
|
|||
var config = configService.getSync();
|
||||
var defaults = configService.getDefaults();
|
||||
|
||||
bwcService.setBaseUrl((config.bwsFor && config.bwsFor[walletId]) || defaults.bws.url);
|
||||
return ((config.bwsFor && config.bwsFor[walletId]) || defaults.bws.url);
|
||||
}
|
||||
|
||||
root.setWalletClient = function(credentials) {
|
||||
|
|
@ -75,17 +75,20 @@ angular.module('copayApp.services')
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$log.debug('Importing wallet:' + credentials.walletId);
|
||||
var skipKeyValidation = root.profile.checked[credentials.walletId] == platformInfo.ua;
|
||||
var client = bwcService.getClient(JSON.stringify(credentials), {
|
||||
baseurl: root._getBaseURL(credentials.walletId),
|
||||
skipKeyValidation: skipKeyValidation,
|
||||
});
|
||||
root.walletClients[credentials.walletId] = client;
|
||||
|
||||
if (client.incorrectDerivation) {
|
||||
$log.warn('Key Derivation failed for wallet:' + credentials.walletId);
|
||||
storageService.clearLastAddress(credentials.walletId, function() {});
|
||||
} else if (!skipKeyValidation) {
|
||||
root.profile.checked[credentials.walletId] = platformInfo.ua;
|
||||
storageService.storeProfileThrottled(root.profile, function() {});
|
||||
}
|
||||
|
||||
client.removeAllListeners();
|
||||
|
|
@ -574,7 +577,7 @@ angular.module('copayApp.services')
|
|||
|
||||
root.setDisclaimerAccepted = function(cb) {
|
||||
root.profile.disclaimerAccepted = true;
|
||||
storageService.storeProfile(root.profile, function(err) {
|
||||
storageService.storeProfileThrottled(root.profile, function(err) {
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
|
@ -626,7 +629,7 @@ angular.module('copayApp.services')
|
|||
newCredentials.push(JSON.parse(fc.export()));
|
||||
root.profile.credentials = newCredentials;
|
||||
|
||||
storageService.storeProfile(root.profile, cb);
|
||||
storageService.storeProfileThrottled(root.profile, cb);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue