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

Function checkInternalApiKey

apps/sim/lib/copilot/request/http.ts:87–104  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

85}
86
87export function checkInternalApiKey(req: NextRequest) {
88 const apiKey = req.headers.get('x-api-key')
89 const expectedApiKey = env.INTERNAL_API_SECRET
90
91 if (!expectedApiKey) {
92 return { success: false, error: 'Internal API key not configured' }
93 }
94
95 if (!apiKey) {
96 return { success: false, error: 'API key required' }
97 }
98
99 if (!safeCompare(apiKey, expectedApiKey)) {
100 return { success: false, error: 'Invalid API key' }
101 }
102
103 return { success: true }
104}

Callers 5

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
updateCostInnerFunction · 0.90

Calls 2

safeCompareFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected