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

Function uuidToBytes

ts/util/uuidToBytes.std.ts:61–72  ·  view source on GitHub ↗
(uuid: string)

Source from the content-addressed store, hash-verified

59}
60
61export function uuidToBytes(uuid: string): Uint8Array<ArrayBuffer> {
62 if (uuid.length !== 36) {
63 log.warn(
64 'received a string of invalid length. Returning an empty Uint8Array'
65 );
66 return new Uint8Array(0);
67 }
68
69 return Uint8Array.from(
70 chunk(uuid.replace(/-/g, ''), 2).map(pair => parseInt(pair.join(''), 16))
71 );
72}

Calls 2

chunkFunction · 0.85
warnMethod · 0.45

Tested by

no test coverage detected