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

Function decryptApiKey

apps/sim/lib/api-key/crypto.ts:42–59  ·  view source on GitHub ↗
(encryptedValue: string)

Source from the content-addressed store, hash-verified

40 * text and returned unchanged.
41 */
42export async function decryptApiKey(encryptedValue: string): Promise<{ decrypted: string }> {
43 const parts = encryptedValue.split(':')
44 if (parts.length !== 3) {
45 return { decrypted: encryptedValue }
46 }
47
48 const key = getApiEncryptionKey()
49 if (!key) {
50 return { decrypted: encryptedValue }
51 }
52
53 try {
54 return await decrypt(encryptedValue, key)
55 } catch (error) {
56 logger.error('API key decryption error:', { error: toError(error).message })
57 throw error
58 }
59}
60
61/**
62 * Generates a standardized API key with the 'sim_' prefix (legacy format)

Callers 4

decryptApiKeyFromStorageFunction · 0.90
crypto.test.tsFile · 0.90
resolveAccessTokenFunction · 0.90
route.tsFile · 0.90

Calls 4

decryptFunction · 0.90
toErrorFunction · 0.90
getApiEncryptionKeyFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected