Let textsecure devices throw on identity key change

Restore error format, accidentally removed in 43d6efcd

// FREEBIE
pull/749/head
lilia 10 years ago
parent 4e88d4a5cf
commit 27016e1919

@ -38109,6 +38109,13 @@ axolotlInternal.RecipientRecord = function() {
window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) {
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
var error = new Error("Identity key changed");
error.identityKey = deviceObject.identityKey;
throw error;
}
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
tempKeys[deviceObject.encodedNumber] = {
preKey: deviceObject.preKey,
@ -38119,6 +38126,7 @@ axolotlInternal.RecipientRecord = function() {
registrationId: deviceObject.registrationId
};
});
});
},
removeTempKeysFromDevice: function(encodedNumber) {

@ -28,6 +28,13 @@
window.textsecure.storage.devices = {
saveKeysToDeviceObject: function(deviceObject) {
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
var error = new Error("Identity key changed");
error.identityKey = deviceObject.identityKey;
throw error;
}
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
tempKeys[deviceObject.encodedNumber] = {
preKey: deviceObject.preKey,
@ -38,6 +45,7 @@
registrationId: deviceObject.registrationId
};
});
});
},
removeTempKeysFromDevice: function(encodedNumber) {

Loading…
Cancel
Save