Handle identity errors on decrypt
Previously we only expected these errors to occur when decrypting prekey messages, so we need to add handling for them in the case of a normal message. // FREEBIE
This commit is contained in:
@@ -38354,6 +38354,16 @@ MessageReceiver.prototype.extend({
|
|||||||
promise = Promise.reject(new Error("Unknown message type"));
|
promise = Promise.reject(new Error("Unknown message type"));
|
||||||
}
|
}
|
||||||
return promise.catch(function(error) {
|
return promise.catch(function(error) {
|
||||||
|
if (error.message === 'Unknown identity key') {
|
||||||
|
// create an error that the UI will pick up and ask the
|
||||||
|
// user if they want to re-negotiate
|
||||||
|
var buffer = dcodeIO.ByteBuffer.wrap(ciphertext);
|
||||||
|
error = new textsecure.IncomingIdentityKeyError(
|
||||||
|
address.toString(),
|
||||||
|
buffer.toArrayBuffer(),
|
||||||
|
error.identityKey
|
||||||
|
);
|
||||||
|
}
|
||||||
var ev = new Event('error');
|
var ev = new Event('error');
|
||||||
ev.error = error;
|
ev.error = error;
|
||||||
ev.proto = envelope;
|
ev.proto = envelope;
|
||||||
|
@@ -149,6 +149,16 @@ MessageReceiver.prototype.extend({
|
|||||||
promise = Promise.reject(new Error("Unknown message type"));
|
promise = Promise.reject(new Error("Unknown message type"));
|
||||||
}
|
}
|
||||||
return promise.catch(function(error) {
|
return promise.catch(function(error) {
|
||||||
|
if (error.message === 'Unknown identity key') {
|
||||||
|
// create an error that the UI will pick up and ask the
|
||||||
|
// user if they want to re-negotiate
|
||||||
|
var buffer = dcodeIO.ByteBuffer.wrap(ciphertext);
|
||||||
|
error = new textsecure.IncomingIdentityKeyError(
|
||||||
|
address.toString(),
|
||||||
|
buffer.toArrayBuffer(),
|
||||||
|
error.identityKey
|
||||||
|
);
|
||||||
|
}
|
||||||
var ev = new Event('error');
|
var ev = new Event('error');
|
||||||
ev.error = error;
|
ev.error = error;
|
||||||
ev.proto = envelope;
|
ev.proto = envelope;
|
||||||
|
Reference in New Issue
Block a user