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

Function encryptApiKeyForStorage

apps/sim/lib/api-key/auth.ts:39–47  ·  view source on GitHub ↗

* Encrypts an API key for secure storage * @param apiKey - The plain text API key to encrypt * @returns Promise - The encrypted key

(apiKey: string)

Source from the content-addressed store, hash-verified

37 * @returns Promise<string> - The encrypted key
38 */
39async 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

Callers 1

createApiKeyFunction · 0.85

Calls 2

encryptApiKeyFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected