Merge pull request #3375 from bitpay/v1.4

v1.4 -> master
This commit is contained in:
Gustavo Maximiliano Cortez 2015-10-30 15:43:17 -03:00
commit f3d12f5a14
17 changed files with 141 additions and 91 deletions

View file

@ -41,15 +41,23 @@ angular.module('copayApp.services')
json = JSON.parse(text);
} catch (e) {};
if (!json) return cb('Could not access storage')
if (!json.iter || !json.ct)
return cb(null, text);
$log.debug('Profile is encrypted');
getUUID(function(uuid) {
$log.debug('Device UUID:' + uuid);
if (!uuid)
return cb(new Error('Could not decrypt localstorage profile'));
return cb('Could not decrypt storage: could not get device ID');
text = sjcl.decrypt(uuid, text);
try {
text = sjcl.decrypt(uuid, text);
} catch(e) {
$log.warn('Decrypt error: ', e);
return cb('Could not decrypt storage: device ID mismatch');
};
return cb(null, text);
});
};