MCPcopy Index your code
hub / github.com/simstudioai/sim / getApiEncryptionKey

Function getApiEncryptionKey

apps/sim/lib/api-key/crypto.ts:10–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8const logger = createLogger('ApiKeyCrypto')
9
10function getApiEncryptionKey(): Buffer | null {
11 const key = env.API_ENCRYPTION_KEY
12 if (!key) {
13 logger.warn(
14 'API_ENCRYPTION_KEY not set - API keys will be stored in plain text. Consider setting this for better security.'
15 )
16 return null
17 }
18 if (key.length !== 64) {
19 throw new Error('API_ENCRYPTION_KEY must be a 64-character hex string (32 bytes)')
20 }
21 return Buffer.from(key, 'hex')
22}
23
24/**
25 * Encrypts an API key using the dedicated API encryption key. Falls back to

Callers 2

encryptApiKeyFunction · 0.85
decryptApiKeyFunction · 0.85

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected