mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-19 07:58:46 +01:00
Introduce Service Id Types
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
committed by
Jamie Kyle
parent
414c0a58d3
commit
366b875fd2
@@ -9,8 +9,9 @@ import Long from 'long';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { UUID_BYTE_SIZE } from '../../types/UUID';
|
||||
import { isAciString, isUntaggedPniString } from '../../types/ServiceId';
|
||||
import * as Bytes from '../../Bytes';
|
||||
import { UUID_BYTE_SIZE } from '../../Crypto';
|
||||
import { uuidToBytes, bytesToUuid } from '../../util/uuidToBytes';
|
||||
import { SignalService as Proto } from '../../protobuf';
|
||||
import type {
|
||||
@@ -246,6 +247,14 @@ function decodeSingleResponse(
|
||||
const e164 = `+${e164Long.toString()}`;
|
||||
const pni = bytesToUuid(pniBytes);
|
||||
const aci = bytesToUuid(aciBytes);
|
||||
strictAssert(
|
||||
aci === undefined || isAciString(aci),
|
||||
'CDSI response has invalid ACI'
|
||||
);
|
||||
strictAssert(
|
||||
pni === undefined || isUntaggedPniString(pni),
|
||||
'CDSI response has invalid PNI'
|
||||
);
|
||||
|
||||
resultMap.set(e164, { pni, aci });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user