remove messages from cache before throwing if the prekey id could not be verified

pull/183/head
sachaaaaa 6 years ago
parent 7186f28019
commit 2755ff06d8

@ -731,11 +731,16 @@ MessageReceiver.prototype.extend({
window.log.info('prekey message from', this.getEnvelopeId(envelope));
promise = captureActiveSession(sessionCipher)
.then(async () => {
const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);
await window.libloki.storage.verifyFriendRequestAcceptPreKey(
envelope.source,
buffer
);
try {
const buffer = dcodeIO.ByteBuffer.wrap(ciphertext);
await window.libloki.storage.verifyFriendRequestAcceptPreKey(
envelope.source,
buffer
);
} catch (e) {
await this.removeFromCache(envelope);
throw e;
}
return this.decryptPreKeyWhisperMessage(
ciphertext,
sessionCipher,

Loading…
Cancel
Save