Short, non-reversible marker of the current password, embedded in the session.
(password: string)
| 84 | |
| 85 | /** Short, non-reversible marker of the current password, embedded in the session. */ |
| 86 | async 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 | |
| 91 | export async function checkPassword(env: Env, submitted: string): Promise<boolean> { |
| 92 | // A misconfigured deployment must not become an open dashboard. |
no test coverage detected