@glinr/theauth, not a plugin. It registers no HTTP routes and does not hook into sign-in on its own: you call enforceSessionLimit before creating a session, and you expose the list and revoke operations from your own routes.
Setup
lib/theauth.ts
theauth.auth.session, or cookieSessionManager.raw if you use createCookieSessionManager).
Enforcing the cap
CallenforceSessionLimit before you create a session, and use buildSessionMetadata to record device and IP:
Sign-in handler
Overflow strategies
List sessions
listSessions(userId) returns all non-expired sessions for a user, newest first. Wire it to your own route to build an “active devices” UI.
List sessions (server)
device and ip are only present when the session was created with metadata from buildSessionMetadata (or your own metadata with those keys). device is a short string parsed from the User-Agent header, such as Chrome on macOS. IP addresses are stored as-is, apply your own masking if required. Any other metadata keys appear under metadata. The result has no current flag, compare id with the caller’s session ID yourself.
Revoke a session
Revoke session (server)
revokeSession deletes the session by ID. It does not check who owns it, so verify that the session belongs to the signed-in user before calling it.
Revoke all other sessions
Sign out all other devices (server)
currentSessionId and returns the number revoked. getSessionCount(userId) returns the number of active sessions.
Configuration reference
What to do when a new sign-in would exceed maxSessions.
Related
Sessions
Core session model with cookie and JWT session details.
Cookie options
Cookie attributes and sliding expiry that affect session lifetime.
Trusted devices
Mark specific devices as trusted so your sign-in flow can skip 2FA.
GDPR compliance
Erase or export user data on request.