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,
|
groupId: envelope.groupId,
|
||||||
requesterDevice: sourceDevice,
|
requesterDevice: sourceDevice,
|
||||||
requesterUuid: sourceUuid,
|
requesterUuid: sourceUuid,
|
||||||
|
ratchetKey: request.ratchetKey(),
|
||||||
senderDevice: request.deviceId(),
|
senderDevice: request.deviceId(),
|
||||||
sentAt: request.timestamp(),
|
sentAt: request.timestamp(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
|
|
||||||
|
import { PublicKey } from '@signalapp/signal-client';
|
||||||
|
|
||||||
import { SignalService as Proto } from '../protobuf';
|
import { SignalService as Proto } from '../protobuf';
|
||||||
import { ProcessedDataMessage, ProcessedSent } from './Types.d';
|
import { ProcessedDataMessage, ProcessedSent } from './Types.d';
|
||||||
import type {
|
import type {
|
||||||
|
@ -92,6 +94,7 @@ export class DecryptionErrorEvent extends Event {
|
||||||
|
|
||||||
export type RetryRequestEventData = Readonly<{
|
export type RetryRequestEventData = Readonly<{
|
||||||
groupId?: string;
|
groupId?: string;
|
||||||
|
ratchetKey?: PublicKey;
|
||||||
requesterUuid: string;
|
requesterUuid: string;
|
||||||
requesterDevice: number;
|
requesterDevice: number;
|
||||||
senderDevice: number;
|
senderDevice: number;
|
||||||
|
|
|
@ -158,6 +158,7 @@ export async function onDecryptionError(
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
async function archiveSessionOnMatch({
|
async function archiveSessionOnMatch({
|
||||||
|
ratchetKey,
|
||||||
requesterUuid,
|
requesterUuid,
|
||||||
requesterDevice,
|
requesterDevice,
|
||||||
senderDevice,
|
senderDevice,
|
||||||
|
@ -166,9 +167,17 @@ async function archiveSessionOnMatch({
|
||||||
window.textsecure.storage.user.getDeviceId(),
|
window.textsecure.storage.user.getDeviceId(),
|
||||||
'archiveSessionOnMatch/getDeviceId'
|
'archiveSessionOnMatch/getDeviceId'
|
||||||
);
|
);
|
||||||
if (ourDeviceId === senderDevice) {
|
if (ourDeviceId !== senderDevice || !ratchetKey) {
|
||||||
const address = `${requesterUuid}.${requesterDevice}`;
|
return;
|
||||||
window.log.info('archiveSessionOnMatch: Devices match, archiving session');
|
}
|
||||||
|
|
||||||
|
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);
|
await window.textsecure.storage.protocol.archiveSession(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +209,7 @@ async function sendDistributionMessageOrNullMessage(
|
||||||
|
|
||||||
if (group && distributionId) {
|
if (group && distributionId) {
|
||||||
window.log.info(
|
window.log.info(
|
||||||
`sendDistributionMessageOrNullMessage/${logId}: Found matching group, sending sender key distribution message'`
|
`sendDistributionMessageOrNullMessage/${logId}: Found matching group, sending sender key distribution message`
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue