MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / decrypt

Function decrypt

packages/auth-server/src/server/crypto.ts:24–35  ·  view source on GitHub ↗
(dataToDecrypt: string)

Source from the content-addressed store, hash-verified

22}
23
24export function decrypt(dataToDecrypt: string): string {
25 if (!SECRET) {
26 throw new Error('missing secret');
27 }
28 const [salt, encrypted] = dataToDecrypt.split(':');
29 const key = scryptSync(SECRET, salt, 32);
30 const iv = Buffer.alloc(16, 0); // Initialization vector.
31 const decipher = createDecipheriv(algorithm, key, iv);
32 let decrypted = decipher.update(encrypted, 'hex', 'utf8');
33 decrypted += decipher.final('utf8');
34 return decrypted;
35}

Callers 1

CreateRouterFunction · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected