Authentication And Sessions
The private area uses passwordless authentication. A person starts at Login, enters their real name, email, phone number, and preferred one-time-code channel, then verifies the received code before opening Private area.
Runtime Flow
- Browser posts to
POST /api/auth/register/start. - Cloudflare Pages forwards
/api/auth/*to the Living Register backend throughQuartz_CL/functions/api/auth/[[path]].ts. - The backend creates or updates
lr_auth_accounts, stores an OTP challenge inlr_auth_challenges, and writes a redacted delivery row inlr_auth_delivery_outbox. - Browser posts the code to
POST /api/auth/verify. - The backend verifies the hashed OTP and returns a session token.
- Browser stores only the session token in local storage under
cl-private-session-token. - Private area calls
GET /api/auth/sessionwithAuthorization: Bearer <token>.
Security Properties
- OTP codes are stored as salted PBKDF2 hashes, never in clear text.
- Session tokens are stored server-side only as SHA-256 token digests.
- OTP challenges expire after 10 minutes.
- A challenge allows at most 5 attempts.
- A new challenge supersedes older pending challenges for the same account.
- Sessions expire after 30 days and can be revoked through
POST /api/auth/logout. - The website displays redacted email and phone values after login.
Production Requirements
Production must not expose development OTP codes in API responses.
Required:
LROS_AUTH_DEV_MODE=0on the Living Register auth backend.LROS_AUTH_API_BASEon Cloudflare Pages, pointing to the HTTPS auth backend without a trailing slash.- Email or SMS delivery worker/provider consuming
lr_auth_delivery_outbox. - Edge and backend rate limits by IP, email, phone, account ID, and challenge ID.
- Provider secrets stored only in Cloudflare/backend environment variables.
Optional:
LROS_AUTH_API_TOKENon Cloudflare Pages when the backend requires a shared internal token. The proxy forwards it asX-CL-Internal-Auth.
What Login Does Not Do
Login does not prove identity-document validity by itself. Identity verification remains a separate LP/LivingRegister process through in-person checks, authority receipts, or the protected temporary upload channel.