MCPcopy Create free account
hub / github.com/Hello-Application-XH/HelloGML / extractAPIKeys

Function extractAPIKeys

src/index.ts:46–51  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

44}
45
46function extractAPIKeys(request: Request): string[] {
47 let auth = request.headers.get("authorization") || request.headers.get("x-api-key") || "";
48 if (!auth) return [];
49 if (!auth.toLowerCase().startsWith("bearer ")) auth = "Bearer " + auth;
50 return auth.slice(7).split(",").map((t) => t.trim()).filter(Boolean);
51}
52
53async function verifyAPIKey(kv: KVNamespace, apiKey: string): Promise<boolean> {
54 const val = await kv.get(`ak:${apiKey}`);

Callers 1

authenticateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected