MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / verifyAdminToken

Function verifyAdminToken

services/db-proxy/src/utils/auth.ts:20–32  ·  view source on GitHub ↗
(c: Context<{ Bindings: Env }>)

Source from the content-addressed store, hash-verified

18 const token = extractBearerToken(c);
19 if (!token) {
20 return false;
21 }
22
23 const adminToken = c.env.DB_PROXY_ADMIN_TOKEN;
24 if (!adminToken || adminToken.trim().length === 0) {
25 return false;
26 }
27
28 return timingSafeEqual(token, adminToken);
29}
30
31/**
32 * Generate a cryptographically random token (32 bytes, hex-encoded)
33 */
34export function generateToken(): string {
35 const bytes = new Uint8Array(32);

Callers 2

auth.test.tsFile · 0.90
requireAdminAuthFunction · 0.85

Calls 2

timingSafeEqualFunction · 0.90
extractBearerTokenFunction · 0.70

Tested by

no test coverage detected