Simplify service id checks in MessageReceiver

This commit is contained in:
Fedor Indutny 2025-04-24 11:24:52 -07:00 committed by GitHub
commit bebdab211e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 11 deletions

View file

@ -1248,16 +1248,9 @@ export default class MessageReceiver
const task = async (): Promise<DecryptResult> => {
const { destinationServiceId } = envelope;
const serviceIdKind =
this.#storage.user.getOurServiceIdKind(destinationServiceId);
if (serviceIdKind === ServiceIdKind.Unknown) {
log.warn(
'MessageReceiver.decryptAndCacheBatch: ' +
`Rejecting envelope ${getEnvelopeId(envelope)}, ` +
`unknown serviceId: ${destinationServiceId}`
);
return { plaintext: undefined, envelope: undefined };
}
const serviceIdKind = isPniString(destinationServiceId)
? ServiceIdKind.PNI
: ServiceIdKind.ACI;
const unsealedEnvelope = await this.#unsealEnvelope(
stores,