* Encrypts an API key for secure storage * @param apiKey - The plain text API key to encrypt * @returns Promise - The encrypted key
(apiKey: string)
| 37 | * @returns Promise<string> - The encrypted key |
| 38 | */ |
| 39 | async function encryptApiKeyForStorage(apiKey: string): Promise<string> { |
| 40 | try { |
| 41 | const { encrypted } = await encryptApiKey(apiKey) |
| 42 | return encrypted |
| 43 | } catch (error) { |
| 44 | logger.error('API key encryption error:', { error }) |
| 45 | throw new Error('Failed to encrypt API key') |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Creates a new API key |
no test coverage detected