commit
f3d12f5a14
17 changed files with 141 additions and 91 deletions
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue