MCPcopy
hub / github.com/codeaashu/claude-code / deriveUserId

Function deriveUserId

src/server/web/auth/apikey-auth.ts:142–144  ·  view source on GitHub ↗

* Derives a stable, opaque user ID from an API key. * Uses the first 16 hex chars of SHA-256(key) — short enough to be readable, * long enough to be unique.

(apiKey: string)

Source from the content-addressed store, hash-verified

140 * long enough to be unique.
141 */
142function deriveUserId(apiKey: string): string {
143 return createHash("sha256").update(apiKey).digest("hex").slice(0, 16);
144}
145
146// Fallback inline login page used when public/login.html is not present.
147const INLINE_LOGIN_HTML = `<!DOCTYPE html>

Callers 1

setupRoutesMethod · 0.85

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected