(apiKey: string)
| 27 | * compatibility with deployments that predate encryption-at-rest. |
| 28 | */ |
| 29 | export async function encryptApiKey(apiKey: string): Promise<{ encrypted: string; iv: string }> { |
| 30 | const key = getApiEncryptionKey() |
| 31 | if (!key) { |
| 32 | return { encrypted: apiKey, iv: '' } |
| 33 | } |
| 34 | return encrypt(apiKey, key) |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Decrypts an API key previously produced by {@link encryptApiKey}. Values |
no test coverage detected