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
pull/749/head
lilia 8 years ago committed by Scott Nonnenberg
parent 1eec94dbb7
commit 6fdd0f1625

@ -38354,6 +38354,16 @@ MessageReceiver.prototype.extend({
promise = Promise.reject(new Error("Unknown message type"));
}
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');
ev.error = error;
ev.proto = envelope;

@ -149,6 +149,16 @@ MessageReceiver.prototype.extend({
promise = Promise.reject(new Error("Unknown message type"));
}
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');
ev.error = error;
ev.proto = envelope;

Loading…
Cancel
Save