Remove support for legacyMessage
This commit is contained in:
parent
97b03d8803
commit
99687a4b5b
3 changed files with 6 additions and 33 deletions
|
@ -26,9 +26,9 @@ message Envelope {
|
|||
optional string source = 2;
|
||||
optional string sourceUuid = 11;
|
||||
optional uint32 sourceDevice = 7;
|
||||
optional string relay = 3;
|
||||
// reserved 3; // formerly optional string relay = 3;
|
||||
optional uint64 timestamp = 5;
|
||||
optional bytes legacyMessage = 6; // Contains an encrypted DataMessage
|
||||
// reserved 6; // formerly optional bytes legacyMessage = 6;
|
||||
optional bytes content = 8; // Contains an encrypted Content
|
||||
optional string serverGuid = 9;
|
||||
optional uint64 serverTimestamp = 10;
|
||||
|
|
|
@ -313,7 +313,6 @@ export default class MessageReceiver
|
|||
)
|
||||
: ourUuid,
|
||||
timestamp: decoded.timestamp?.toNumber(),
|
||||
legacyMessage: dropNull(decoded.legacyMessage),
|
||||
content: dropNull(decoded.content),
|
||||
serverGuid: decoded.serverGuid,
|
||||
serverTimestamp,
|
||||
|
@ -706,7 +705,6 @@ export default class MessageReceiver
|
|||
decoded.destinationUuid || item.destinationUuid || ourUuid.toString()
|
||||
),
|
||||
timestamp: decoded.timestamp?.toNumber(),
|
||||
legacyMessage: dropNull(decoded.legacyMessage),
|
||||
content: dropNull(decoded.content),
|
||||
serverGuid: decoded.serverGuid,
|
||||
serverTimestamp:
|
||||
|
@ -1124,14 +1122,9 @@ export default class MessageReceiver
|
|||
|
||||
return;
|
||||
}
|
||||
if (envelope.legacyMessage) {
|
||||
await this.innerHandleLegacyMessage(envelope, plaintext);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.removeFromCache(envelope);
|
||||
throw new Error('Received message with no content and no legacyMessage');
|
||||
throw new Error('Received message with no content');
|
||||
}
|
||||
|
||||
private async unsealEnvelope(
|
||||
|
@ -1161,10 +1154,10 @@ export default class MessageReceiver
|
|||
|
||||
strictAssert(uuidKind === UUIDKind.ACI, 'Sealed non-ACI envelope');
|
||||
|
||||
const ciphertext = envelope.content || envelope.legacyMessage;
|
||||
const ciphertext = envelope.content;
|
||||
if (!ciphertext) {
|
||||
this.removeFromCache(envelope);
|
||||
throw new Error('Received message with no content and no legacyMessage');
|
||||
throw new Error('Received message with no content');
|
||||
}
|
||||
|
||||
log.info(`MessageReceiver.unsealEnvelope(${logId}): unidentified message`);
|
||||
|
@ -1226,12 +1219,8 @@ export default class MessageReceiver
|
|||
}
|
||||
|
||||
let ciphertext: Uint8Array;
|
||||
let isLegacy = false;
|
||||
if (envelope.content) {
|
||||
ciphertext = envelope.content;
|
||||
} else if (envelope.legacyMessage) {
|
||||
ciphertext = envelope.legacyMessage;
|
||||
isLegacy = true;
|
||||
} else {
|
||||
this.removeFromCache(envelope);
|
||||
strictAssert(
|
||||
|
@ -1240,9 +1229,7 @@ export default class MessageReceiver
|
|||
);
|
||||
}
|
||||
|
||||
log.info(
|
||||
`MessageReceiver.decryptEnvelope(${logId})${isLegacy ? ' (legacy)' : ''}`
|
||||
);
|
||||
log.info(`MessageReceiver.decryptEnvelope(${logId})`);
|
||||
const plaintext = await this.decrypt(
|
||||
stores,
|
||||
envelope,
|
||||
|
@ -1255,11 +1242,6 @@ export default class MessageReceiver
|
|||
return { plaintext, envelope };
|
||||
}
|
||||
|
||||
// Legacy envelopes do not carry senderKeyDistributionMessage
|
||||
if (isLegacy) {
|
||||
return { plaintext, envelope };
|
||||
}
|
||||
|
||||
// Note: we need to process this as part of decryption, because we might need this
|
||||
// sender key to decrypt the next message in the queue!
|
||||
try {
|
||||
|
@ -1966,14 +1948,6 @@ export default class MessageReceiver
|
|||
return this.dispatchAndWait(ev);
|
||||
}
|
||||
|
||||
private async innerHandleLegacyMessage(
|
||||
envelope: ProcessedEnvelope,
|
||||
plaintext: Uint8Array
|
||||
) {
|
||||
const message = Proto.DataMessage.decode(plaintext);
|
||||
return this.handleDataMessage(envelope, message);
|
||||
}
|
||||
|
||||
private async maybeUpdateTimestamp(
|
||||
envelope: ProcessedEnvelope
|
||||
): Promise<ProcessedEnvelope> {
|
||||
|
|
1
ts/textsecure/Types.d.ts
vendored
1
ts/textsecure/Types.d.ts
vendored
|
@ -85,7 +85,6 @@ export type ProcessedEnvelope = Readonly<{
|
|||
sourceDevice?: number;
|
||||
destinationUuid: UUID;
|
||||
timestamp: number;
|
||||
legacyMessage?: Uint8Array;
|
||||
content?: Uint8Array;
|
||||
serverGuid: string;
|
||||
serverTimestamp: number;
|
||||
|
|
Loading…
Reference in a new issue