archiveSessionOnMatch: Check for ratchet key match as well
This commit is contained in:
parent
fdec47d637
commit
b0eaae93f1
3 changed files with 17 additions and 4 deletions
|
@ -1926,6 +1926,7 @@ class MessageReceiverInner extends EventTarget {
|
|||
groupId: envelope.groupId,
|
||||
requesterDevice: sourceDevice,
|
||||
requesterUuid: sourceUuid,
|
||||
ratchetKey: request.ratchetKey(),
|
||||
senderDevice: request.deviceId(),
|
||||
sentAt: request.timestamp(),
|
||||
});
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
import { PublicKey } from '@signalapp/signal-client';
|
||||
|
||||
import { SignalService as Proto } from '../protobuf';
|
||||
import { ProcessedDataMessage, ProcessedSent } from './Types.d';
|
||||
import type {
|
||||
|
@ -92,6 +94,7 @@ export class DecryptionErrorEvent extends Event {
|
|||
|
||||
export type RetryRequestEventData = Readonly<{
|
||||
groupId?: string;
|
||||
ratchetKey?: PublicKey;
|
||||
requesterUuid: string;
|
||||
requesterDevice: number;
|
||||
senderDevice: number;
|
||||
|
|
|
@ -158,6 +158,7 @@ export async function onDecryptionError(
|
|||
// Helpers
|
||||
|
||||
async function archiveSessionOnMatch({
|
||||
ratchetKey,
|
||||
requesterUuid,
|
||||
requesterDevice,
|
||||
senderDevice,
|
||||
|
@ -166,9 +167,17 @@ async function archiveSessionOnMatch({
|
|||
window.textsecure.storage.user.getDeviceId(),
|
||||
'archiveSessionOnMatch/getDeviceId'
|
||||
);
|
||||
if (ourDeviceId === senderDevice) {
|
||||
const address = `${requesterUuid}.${requesterDevice}`;
|
||||
window.log.info('archiveSessionOnMatch: Devices match, archiving session');
|
||||
if (ourDeviceId !== senderDevice || !ratchetKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
const address = `${requesterUuid}.${requesterDevice}`;
|
||||
const session = await window.textsecure.storage.protocol.loadSession(address);
|
||||
|
||||
if (session && session.currentRatchetKeyMatches(ratchetKey)) {
|
||||
window.log.info(
|
||||
'archiveSessionOnMatch: Matching device and ratchetKey, archiving session'
|
||||
);
|
||||
await window.textsecure.storage.protocol.archiveSession(address);
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +209,7 @@ async function sendDistributionMessageOrNullMessage(
|
|||
|
||||
if (group && distributionId) {
|
||||
window.log.info(
|
||||
`sendDistributionMessageOrNullMessage/${logId}: Found matching group, sending sender key distribution message'`
|
||||
`sendDistributionMessageOrNullMessage/${logId}: Found matching group, sending sender key distribution message`
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue