Let textsecure devices throw on identity key change
Restore error format, accidentally removed in 43d6efcd
// FREEBIE
This commit is contained in:
parent
4e88d4a5cf
commit
27016e1919
2 changed files with 34 additions and 18 deletions
|
@ -38109,15 +38109,23 @@ axolotlInternal.RecipientRecord = function() {
|
||||||
window.textsecure.storage.devices = {
|
window.textsecure.storage.devices = {
|
||||||
saveKeysToDeviceObject: function(deviceObject) {
|
saveKeysToDeviceObject: function(deviceObject) {
|
||||||
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
|
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
|
||||||
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
|
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
|
||||||
tempKeys[deviceObject.encodedNumber] = {
|
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
|
||||||
preKey: deviceObject.preKey,
|
var error = new Error("Identity key changed");
|
||||||
preKeyId: deviceObject.preKeyId,
|
error.identityKey = deviceObject.identityKey;
|
||||||
signedKey: deviceObject.signedKey,
|
throw error;
|
||||||
signedKeyId: deviceObject.signedKeyId,
|
}
|
||||||
signedKeySignature: deviceObject.signedKeySignature,
|
|
||||||
registrationId: deviceObject.registrationId
|
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
|
||||||
};
|
tempKeys[deviceObject.encodedNumber] = {
|
||||||
|
preKey: deviceObject.preKey,
|
||||||
|
preKeyId: deviceObject.preKeyId,
|
||||||
|
signedKey: deviceObject.signedKey,
|
||||||
|
signedKeyId: deviceObject.signedKeyId,
|
||||||
|
signedKeySignature: deviceObject.signedKeySignature,
|
||||||
|
registrationId: deviceObject.registrationId
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,23 @@
|
||||||
window.textsecure.storage.devices = {
|
window.textsecure.storage.devices = {
|
||||||
saveKeysToDeviceObject: function(deviceObject) {
|
saveKeysToDeviceObject: function(deviceObject) {
|
||||||
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
|
var number = textsecure.utils.unencodeNumber(deviceObject.encodedNumber)[0];
|
||||||
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
|
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
|
||||||
tempKeys[deviceObject.encodedNumber] = {
|
if (identityKey !== undefined && deviceObject.identityKey !== undefined && getString(identityKey) != getString(deviceObject.identityKey)) {
|
||||||
preKey: deviceObject.preKey,
|
var error = new Error("Identity key changed");
|
||||||
preKeyId: deviceObject.preKeyId,
|
error.identityKey = deviceObject.identityKey;
|
||||||
signedKey: deviceObject.signedKey,
|
throw error;
|
||||||
signedKeyId: deviceObject.signedKeyId,
|
}
|
||||||
signedKeySignature: deviceObject.signedKeySignature,
|
|
||||||
registrationId: deviceObject.registrationId
|
return textsecure.storage.axolotl.putIdentityKey(number, deviceObject.identityKey).then(function() {
|
||||||
};
|
tempKeys[deviceObject.encodedNumber] = {
|
||||||
|
preKey: deviceObject.preKey,
|
||||||
|
preKeyId: deviceObject.preKeyId,
|
||||||
|
signedKey: deviceObject.signedKey,
|
||||||
|
signedKeyId: deviceObject.signedKeyId,
|
||||||
|
signedKeySignature: deviceObject.signedKeySignature,
|
||||||
|
registrationId: deviceObject.registrationId
|
||||||
|
};
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue