· 2 min read
How the admin signs in: passkeys, short sessions and a 30-day cookie
The admin has no password. A walk through the passkey setup, the 10-minute session cookie, the rotating 30-day client token and what the server stores.
The admin of this site has no password. Sign-in uses a passkey, and the server only ever holds the passkey's public key. This post walks through how the pieces fit, in the order a visitor to the login page would meet them.
The first passkey
A new install has no passkeys, so the setup page asks for a setup token, a secret kept in the server's environment. The token works only while zero passkeys exist. After the first one is registered, the server stops comparing the token at all, so it cannot be probed, and the setup page says setup is closed.
Adding a device later
More passkeys can be added from Settings, but only by an admin who signed in within the last 10 minutes. Anyone else is told to sign out, sign back in and try again. The Remove button is disabled when only one passkey is left.
Every step of a WebAuthn ceremony starts with a challenge that the server saves and expires after five minutes. The login and registration endpoints are rate limited per hashed IP address, and registration has an extra limit across all visitors.
Two cookies
A signed-in browser carries two cookies. The first is a session token, a signed JWT that lives for 10 minutes. The second is a client token that lives for 30 days. The server stores only a SHA-256 hash of the client token.
When the short token expires, the browser trades the client token for a new session through a refresh endpoint, and the client token is rotated at the same time. Pages that load in parallel can present the same token twice, so the previous token is still accepted for 30 seconds. Presenting an older, already retired token after that is treated as theft and revokes the whole session. A session also has a hard limit of 90 days, however often it refreshes.
Where access is checked
The proxy in front of the admin only checks that the JWT signature is valid. It never touches the database, so it is a quick first filter and nothing more. The real check happens in a data access layer that every admin page, Server Action and API route calls before doing anything.
Managing sessions
Settings lists every active session with its browser and operating system, marks the current one, and has a button that signs out every other device. Revoking a session ends it.