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

Function getApiKeyDisplayFormat

apps/sim/lib/api-key/auth.ts:104–116  ·  view source on GitHub ↗
(encryptedKey: string)

Source from the content-addressed store, hash-verified

102 * @returns Promise<string> - The display format like "sk-sim-...r6AA"
103 */
104export async function getApiKeyDisplayFormat(encryptedKey: string): Promise<string> {
105 try {
106 if (isEncryptedKey(encryptedKey)) {
107 const decryptedKey = await decryptApiKeyFromStorage(encryptedKey)
108 return formatApiKeyForDisplay(decryptedKey)
109 }
110 // For plain text keys (legacy), format directly
111 return formatApiKeyForDisplay(encryptedKey)
112 } catch (error) {
113 logger.error('Failed to format API key for display:', { error })
114 return '****'
115 }
116}
117
118/**
119 * Formats an API key for display showing prefix and last 4 characters

Callers 2

route.tsFile · 0.90
route.tsFile · 0.90

Calls 4

decryptApiKeyFromStorageFunction · 0.85
formatApiKeyForDisplayFunction · 0.85
errorMethod · 0.80
isEncryptedKeyFunction · 0.70

Tested by

no test coverage detected