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

Function getKey

packages/db/src/encryption.ts:8–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6const ENCODING = 'base64';
7
8function getKey(): Buffer {
9 const raw = process.env.ENCRYPTION_KEY;
10 if (!raw) {
11 throw new Error('ENCRYPTION_KEY environment variable is not set');
12 }
13 const buf = Buffer.from(raw, 'hex');
14 if (buf.length !== 32) {
15 throw new Error(
16 'ENCRYPTION_KEY must be a 64-character hex string (32 bytes)'
17 );
18 }
19 return buf;
20}
21
22export function encrypt(plaintext: string): string {
23 const key = getKey();

Callers 3

encryptFunction · 0.70
decryptFunction · 0.70
buildLookupMapFunction · 0.50

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected