Message Send Log to enable comprehensive resend

This commit is contained in:
Scott Nonnenberg 2021-07-15 16:48:09 -07:00 committed by GitHub
parent 0fe68b57b1
commit a42c41ed01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 3154 additions and 1266 deletions

View file

@ -24,6 +24,7 @@ import {
typedArrayToArrayBuffer,
} from './Crypto';
import { assert } from './util/assert';
import { handleMessageSend } from './util/handleMessageSend';
import { isNotNil } from './util/isNotNil';
import { Zone } from './util/Zone';
import { isMoreRecentThan } from './util/timestamp';
@ -590,6 +591,13 @@ export class SignalProtocolStore extends EventsMixin {
}
}
async clearSenderKeyStore(): Promise<void> {
if (this.senderKeys) {
this.senderKeys.clear();
}
await window.Signal.Data.removeAllSenderKeys();
}
// Session Queue
async enqueueSessionJob<T>(
@ -1231,7 +1239,14 @@ export class SignalProtocolStore extends EventsMixin {
// Send a null message with newly-created session
const sendOptions = await getSendOptions(conversation.attributes);
await window.textsecure.messaging.sendNullMessage({ uuid }, sendOptions);
const result = await handleMessageSend(
window.textsecure.messaging.sendNullMessage({ uuid }, sendOptions),
{ messageIds: [], sendType: 'nullMessage' }
);
if (result && result.errors && result.errors.length) {
throw result.errors[0];
}
} catch (error) {
// If we failed to do the session reset, then we'll allow another attempt sooner
// than one hour from now.