(req: Request)
| 390 | }); |
| 391 | } |
| 392 | function checkAuth(req: Request): Response | void { |
| 393 | const h = req.headers.get("Authorization") || ""; |
| 394 | const m = h.match(/^Bearer\s+(.+)$/i); |
| 395 | if (!m) return json({ error: "unauthorized" }, 401); |
| 396 | if (!VALID_CLIENT_KEYS.has(m[1].trim())) return json({ error: "forbidden" }, 403); |
| 397 | } |