Merge pull request #4338 from matiu/bug/ios-key-derivation-cache

fix key derivation cache in IOS
This commit is contained in:
Gustavo Maximiliano Cortez 2016-06-09 17:56:21 -03:00 committed by GitHub
commit 4f5090aec9
3 changed files with 8 additions and 12 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go) {
function($scope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService) {
var self = this;
self.tries = 0;
self.creatingProfile = true;
@ -38,7 +38,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
$ionicSideMenuDelegate.canDragContent(false);
self.lang = uxLanguage.currentLanguage;
profileService.getProfile(function(err, profile) {
storageService.getProfile(function(err, profile) {
if (!profile) {
create(opts);
} else {

View file

@ -5,10 +5,13 @@ angular.module('copayApp.services').factory('platformInfo', function($window) {
var ua = navigator ? navigator.userAgent : null;
if (!ua) {
console.log('Could not determine navigator. Using a random string');
ua = Math.floor(Math.random() * 100000);
console.log('Could not determine navigator. Using fixed string');
ua = 'dummy user-agent';
}
// Fixes IOS WebKit UA
ua = ua.replace(/\(\d+\)$/, '');
var isNodeWebkit = function() {
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
if (isNode) {

View file

@ -127,7 +127,6 @@ angular.module('copayApp.services')
if (!credentials.walletId)
throw 'bindWallet should receive credentials JSON';
$log.debug('Bind wallet:' + credentials.walletId);
// Create the client
var getBWSURL = function(walletId) {
@ -137,6 +136,7 @@ angular.module('copayApp.services')
};
var skipKeyValidation = root.profile.isChecked(platformInfo.ua, credentials.walletId);
$log.info('Binding wallet:' + credentials.walletId + ' Validating?:' + !skipKeyValidation);
var client = bwcService.getClient(JSON.stringify(credentials), {
bwsurl: getBWSURL(credentials.walletId),
skipKeyValidation: skipKeyValidation,
@ -200,13 +200,6 @@ angular.module('copayApp.services')
});
};
root.getProfile = function(cb) {
storageService.getProfile(function(err, profile) {
return cb(err, profile);
});
};
root.loadAndBindProfile = function(cb) {
storageService.getProfile(function(err, profile) {
if (err) {