By default, KavachOS allows unlimited concurrent sessions per user. The multi-session module adds a cap, a configurable overflow strategy, and endpoints for listing and revoking sessions, useful for building an “active devices” settings page.Documentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
Setup
lib/kavach.ts
Overflow strategies
| Strategy | Behavior |
|---|---|
evict-oldest | Deletes the least-recently-used session when the cap is reached |
reject | Returns 429 with code SESSION_LIMIT_REACHED, new sign-in fails |
List sessions
GET /auth/sessions
Returns all active sessions for the authenticated user. Useful for building an “active devices” UI.
List sessions (client)
User-Agent header at sign-in time. IP addresses are stored as-is, apply your own masking if required.
Revoke a session
DELETE /auth/sessions/:id
Revokes a specific session. Users can revoke any of their own sessions, including the current one.
Revoke session (client)
Revoke all other sessions
DELETE /auth/sessions
Revokes all sessions for the user except the current one. Useful for “sign out everywhere else” buttons.
Sign out all other devices (client)
Configuration reference
Maximum concurrent sessions per user. Set to 0 for unlimited.
What to do when a new sign-in would exceed maxSessions.
Parse and store browser/OS information from the User-Agent header.
Store the IP address of the sign-in request.