Fix password hashing for Workers runtime

This commit is contained in:
巫凤萍
2026-08-07 11:20:31 +08:00
parent c926a6a874
commit bd9b0c3871
2 changed files with 3 additions and 1 deletions

View File

@@ -15,7 +15,8 @@ export type RequestPrincipal =
const SESSION_COOKIE = "koc_session";
const SESSION_MAX_AGE_SECONDS = 60 * 60 * 24 * 7;
const PASSWORD_ITERATIONS = 120_000;
// Cloudflare Workers caps PBKDF2 at 100,000 iterations.
const PASSWORD_ITERATIONS = 100_000;
function bytesToHex(bytes: Uint8Array) {
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");