Login + sessions + logout (30min idle, 7d max) #6
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/chat#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#2
What to build
Returning users authenticate at
/loginwith their passkey. On a successful WebAuthn assertion with the PRF extension, the backend derives the AES key, decrypts the stored ciphertext, creates an in-RAM session keyed by a cryptographically-random opaque sessionID, sets the sessionID as anHttpOnly; Secure; SameSite=Laxcookie, and redirects. An auth middleware protects every route except/login,/register,/static/*,/healthz. Idle timeout (30min) and absolute cap (7d) evict sessions. Explicit logout clears server state and the cookie. Server restart wipes RAM — users must re-authenticate.Acceptance criteria
/loginreturns the login page (passkey button only — no fields)navigator.credentials.get()with PRF extension/HttpOnly; Secure; SameSite=Lax; Path=/; value is base64url of 32 random bytes{userID, plaintextToken, serverURL, createdAt, lastActivity}in a concurrent-safe in-memory maplastActivity/logoutclears server-side session and unsets cookieinternal/auth: session map race-free under concurrent reads/writes; idle eviction works; absolute-cap eviction works; sessionID generation is unique under loadBlocked by