MCPcopy Create free account
hub / github.com/FIND-Lab/AgentWard / decrypt

Function decrypt

util/crypto-util.ts:26–35  ·  view source on GitHub ↗
(buffer: Uint8Array, key: AesKey)

Source from the content-addressed store, hash-verified

24}
25
26export function decrypt(buffer: Uint8Array, key: AesKey): string {
27 const nonce = buffer.subarray(0, NONCE_SIZE);
28 const tag = buffer.subarray(buffer.length - TAG_SIZE);
29 const ciphertext = buffer.subarray(NONCE_SIZE, buffer.length - TAG_SIZE);
30 const decipher = createDecipheriv('aes-256-gcm', key, nonce);
31 decipher.setAuthTag(tag);
32 const plaintext = decipher.update(ciphertext);
33 decipher.final();
34 return plaintext.toString('utf8');
35}

Callers 2

processRequestAsyncFunction · 0.90
callMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected