Merge pull request #137 from willchen96/require-user-api-key-secret

fix: update encryption key retrieval to use only USER_API_KEYS_ENCRYPTION_SECRET
This commit is contained in:
cosimoastrada 2026-05-16 00:55:57 +08:00 committed by GitHub
commit aed8c42e94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,12 +37,9 @@ export function hasEnvApiKey(provider: ApiKeyProvider): boolean {
}
function encryptionKey(): Buffer {
const secret =
process.env.USER_API_KEYS_ENCRYPTION_SECRET ||
process.env.API_KEYS_ENCRYPTION_SECRET ||
process.env.SUPABASE_SECRET_KEY;
const secret = process.env.USER_API_KEYS_ENCRYPTION_SECRET;
if (!secret) {
throw new Error("API key encryption secret is not configured");
throw new Error("USER_API_KEYS_ENCRYPTION_SECRET is not configured");
}
return crypto.createHash("sha256").update(secret).digest();
}