MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / decrypt

Function decrypt

packages/db/src/encryption.ts:35–44  ·  view source on GitHub ↗
(ciphertext: string)

Source from the content-addressed store, hash-verified

33}
34
35export function decrypt(ciphertext: string): string {
36 const key = getKey();
37 const buf = Buffer.from(ciphertext, ENCODING);
38 const iv = buf.subarray(0, IV_LENGTH);
39 const tag = buf.subarray(IV_LENGTH, IV_LENGTH + TAG_LENGTH);
40 const encrypted = buf.subarray(IV_LENGTH + TAG_LENGTH);
41 const decipher = createDecipheriv(ALGORITHM, key, iv);
42 decipher.setAuthTag(tag);
43 return decipher.update(encrypted) + decipher.final('utf8');
44}

Callers 2

getGscAccessTokenFunction · 0.90
auth.tsFile · 0.90

Calls 2

getKeyFunction · 0.70
fromMethod · 0.45

Tested by

no test coverage detected