MCPcopy
hub / github.com/signalapp/Signal-Desktop / bytesToUuid

Function bytesToUuid

ts/util/uuidToBytes.std.ts:21–37  ·  view source on GitHub ↗
(
  bytes: Uint8Array<ArrayBuffer>
)

Source from the content-addressed store, hash-verified

19}
20
21export function bytesToUuid(
22 bytes: Uint8Array<ArrayBuffer>
23): undefined | string {
24 if (bytes.byteLength !== UUID_BYTE_SIZE) {
25 log.warn(
26 'bytesToUuid: received an Uint8Array of invalid length. ' +
27 'Returning undefined'
28 );
29 return undefined;
30 }
31
32 const uuids = splitUuids(bytes);
33 if (uuids.length === 1) {
34 return uuids[0] || undefined;
35 }
36 return undefined;
37}
38
39function splitUuids(buffer: Uint8Array<ArrayBuffer>): Array<string | null> {
40 const uuids = new Array<string | null>();

Callers 15

processAttachmentFunction · 0.90
jobMethod · 0.90
#formatUserIdMethod · 0.90

Calls 2

splitUuidsFunction · 0.85
warnMethod · 0.45

Tested by

no test coverage detected