MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / passwordFingerprint

Function passwordFingerprint

telemetry-dashboard/src/auth.ts:86–89  ·  view source on GitHub ↗

Short, non-reversible marker of the current password, embedded in the session.

(password: string)

Source from the content-addressed store, hash-verified

84
85/** Short, non-reversible marker of the current password, embedded in the session. */
86async function passwordFingerprint(password: string): Promise<string> {
87 const digest = await crypto.subtle.digest('SHA-256', encoder.encode(`cg-admin-pw\u0000${password}`));
88 return base64UrlEncode(new Uint8Array(digest).subarray(0, 8));
89}
90
91export async function checkPassword(env: Env, submitted: string): Promise<boolean> {
92 // A misconfigured deployment must not become an open dashboard.

Callers 2

issueSessionFunction · 0.85
hasValidSessionFunction · 0.85

Calls 1

base64UrlEncodeFunction · 0.85

Tested by

no test coverage detected