MCPcopy Create free account
hub / github.com/ConsortiumAI/Consortium / toArrayBuffer

Function toArrayBuffer

packages/consortium-web/src/lib/encryption.ts:120–122  ·  view source on GitHub ↗

Convert Uint8Array to ArrayBuffer (needed for SubtleCrypto)

(arr: Uint8Array)

Source from the content-addressed store, hash-verified

118
119/** Convert Uint8Array to ArrayBuffer (needed for SubtleCrypto) */
120function toArrayBuffer(arr: Uint8Array): ArrayBuffer {
121 return arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) as ArrayBuffer;
122}
123
124let aesKeyCache = new WeakMap<Uint8Array, CryptoKey>();
125

Callers 3

getAesKeyFunction · 0.85
encryptWithDataKeyFunction · 0.85
decryptWithDataKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected