// Role model for the app. Access is either full "admin" or read-only "user". export type Role = "admin" | "user"; // Constant-time string comparison to avoid leaking secrets via timing. // Pure JS (no node:crypto) so this stays cheap and dependency-free. export function safeEqual(a: string, b: string): boolean { if (a.length !== b.length) return false; let mismatch = 0; for (let i = 0; i < a.length; i++) { mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i); } return mismatch === 0; }