(req, token, body, callerKey = '')
| 103 | } |
| 104 | |
| 105 | function nativeBridgeCallerKeyForRequest(req, token, body, callerKey = '') { |
| 106 | const key = callerKey || callerKeyFromRequest(req, token, body); |
| 107 | const tokenAllowlist = String(process.env.WINDSURFAPI_NATIVE_TOOL_BRIDGE_API_KEYS || '') |
| 108 | .split(',') |
| 109 | .map(s => s.trim()) |
| 110 | .filter(Boolean); |
| 111 | if (!tokenAllowlist.length) return key; |
| 112 | return tokenAllowlist.includes(String(token || '').trim()) ? `${key}:api_key_allowed` : key; |
| 113 | } |
| 114 | |
| 115 | function json(res, status, body) { |
| 116 | const data = JSON.stringify(body); |
no test coverage detected