MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / hasBearerToken

Function hasBearerToken

apps/local/src/serve-shared.ts:59–63  ·  view source on GitHub ↗
(request: Request, token: string)

Source from the content-addressed store, hash-verified

57};
58
59export const hasBearerToken = (request: Request, token: string): boolean => {
60 const authorization = request.headers.get("authorization");
61 const bearer = authorization?.match(/^Bearer\s+(.+)$/i)?.[1]?.trim();
62 return bearer !== undefined && safeEqual(bearer, token);
63};
64
65/** The request gate: a valid `Authorization: Bearer <token>` header. */
66export const makeIsAuthorized =

Callers 2

makeIsAuthorizedFunction · 0.85

Calls 2

safeEqualFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected