MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / isAuthorized

Function isAuthorized

src/middleware.ts:18–24  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

16}
17
18function isAuthorized(req: NextRequest): boolean {
19 if (!ADMIN_KEY) return false;
20 const header = req.headers.get("authorization");
21 if (!header) return false;
22 const [scheme, token] = header.split(" ", 2);
23 return scheme === "Bearer" && token === ADMIN_KEY;
24}
25
26// ---------------------------------------------------------------------------
27// Rate Limiting (in-memory fixed-window counter)

Callers 1

middlewareFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected