| 1 | // Tunable constants for the account service. Durations are in milliseconds. |
| 2 | |
| 3 | export const SESSION_COOKIE = "rxid"; |
| 4 | |
| 5 | export const SESSION_TTL_MS = 30 * 24 * 60 * 60 * 1000; // 30 days |
| 6 | export const VERIFY_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours |
| 7 | export const RESET_TTL_MS = 60 * 60 * 1000; // 1 hour |
| 8 | |
| 9 | // Device-authorization flow (CLI/desktop sign-in). |
| 10 | export const DEVICE_CODE_TTL_MS = 10 * 60 * 1000; // 10 minutes to approve |
| 11 | export const DEVICE_POLL_INTERVAL_S = 5; // client poll cadence; faster polls get slow_down |
| 12 | |
| 13 | // PBKDF2-HMAC-SHA256 work factor. Cloudflare Workers hard-caps PBKDF2 at 100k |
| 14 | // iterations (it throws NotSupportedError above that), so this is the platform |
| 15 | // ceiling. The value is embedded in each stored hash, so it can be raised later |
| 16 | // (e.g. if the cap is lifted) without breaking existing logins. |
| 17 | export const PBKDF2_ITERATIONS = 100_000; |
| 18 | |
| 19 | export const MIN_PASSWORD = 8; |
| 20 | export const MAX_PASSWORD = 200; |
| 21 |