MCPcopy Create free account
hub / github.com/aetherstate/GODMOD3.AI / getValidKeys

Function getValidKeys

HF/api/middleware/auth.ts:13–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11import type { Request, Response, NextFunction } from 'express'
12
13function getValidKeys(): Set<string> | null {
14 const multi = process.env.GODMODE_API_KEYS
15 if (multi) {
16 return new Set(multi.split(',').map(k => k.trim()).filter(Boolean))
17 }
18 const single = process.env.GODMODE_API_KEY
19 if (single) {
20 return new Set([single.trim()])
21 }
22 return null // Auth disabled
23}
24
25export function apiKeyAuth(req: Request, res: Response, next: NextFunction): void {
26 const validKeys = getValidKeys()

Callers 1

apiKeyAuthFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected