fix(database): respect Workers PBKDF2 iteration limit
This commit is contained in:
1 parent
9862348d70
commit
349ac4fc87
15 files changed
+26
-14
No files matched your search
+2
-1
@@ -7,7 +7,8 @@ const TABLES = {
|
||||
};
|
||||
const META = new Set(["profile", "settings", "system"]);
|
||||
const DURATION = 20 * 60 * 1000;
|
||||
const ITERATIONS = 210_000;
|
||||
// The deployed Workers runtime rejects PBKDF2 counts above 100,000.
|
||||
const ITERATIONS = 100_000;
|
||||
const body = (value, status = 200) => Response.json(value, { status, headers: { "cache-control": "no-store" } });
|
||||
const validId = value => typeof value === "string" && value.length > 0 && value.length <= 200;
|
||||
const hash = async value => [...new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value)))].map(byte => byte.toString(16).padStart(2, "0")).join("");
|
||||
|
||||
Reference in new issue
Block a user