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

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

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

Loading…
Cancel
Save