Skip to content

Authentication

A request carries at most one credential. A request that sends two, such as a cookie and a signature, answers 400 with the problem conflicting-credentials.

Scheme in the reference Credential 401 challenge
web-session The cookie __Secure-better-auth.session_token Session
connected-app An HTTP Message Signature by a connected app’s key Signature
operator Authorization: Bearer …, for voidFS’s own admin page Bearer

The OpenAPI document also declares a device scheme, a signature by a device or recovery key. No /v1 operation accepts it yet.

A 401 names the schemes its operation accepts in WWW-Authenticate, and adds Accept-Signature when one of them is Signature.

voidFS signs people in with an email address and a code sent to it; there is no password. Better Auth runs sign-in and sessions, at its own paths under /auth. The service serves four of them:

Operation What it does
POST /auth/email-otp/send-verification-otp Sends a code to an email address. One code a minute for an address; a code is valid for 5 minutes.
POST /auth/sign-in/email-otp Signs in with the code and sets the session cookie. The reply carries no session token.
GET /auth/get-session Reads the caller’s own session.
POST /auth/sign-out Ends the session.

These paths and their request bodies are Better Auth’s contract, and an error that the library writes has the library’s JSON shape, not the problem format. The service changes two successful replies: signing in and reading the session return only {"user": {…}}, without the library’s session fields and so without a session token, and signing in adds "userCreated": true when it created the user. There is no /v1/sessions. Every other Better Auth path answers 404, including list-sessions and the revoke-session paths.

A session is for the web app. The service serves the two email-code steps to the web app’s origin, https://app.voidfs.com, and to its email pages at https://auth.voidfs.com; it serves reading and ending a session to https://app.voidfs.com only. Any other caller gets 403 with the problem origin. Sending a code needs a Turnstile token that the web app’s email page obtains, and the session cookie counts only on requests from the web app’s origin. A program of yours does not sign in with a session. It becomes a connected app.

A connected app is a program the owner approves with its own key, such as the CLI. The owner can rename it, set it to expire, and revoke it; a revoked app loses access with its next request.

A connected app can read and change the account’s files, read the account and its plan, and list, rename and revoke connected apps. It cannot delete the account or all of its files, add or remove a passkey, approve another app or start a checkout: those need the owner in the web app. Each operation’s page in the reference names the credentials it accepts.

The app creates two key pairs and keeps the private keys: an Ed25519 pair that signs its requests and an X25519 pair that the account’s files key is wrapped for. Its app ID is the SHA-256, in lowercase hex, of this JSON array of strings, written without spaces:

["voidfs-connected-app-v1","https://api.voidfs.com","key","<signing public key, hex>","<wrapping public key, hex>"]

The approval code is the first 80 bits of that hash in Base32 (RFC 4648), in four groups of four: WPBZ-4SUQ-6YIT-GGCF. Because the code comes from both public keys, the owner who types it approves exactly these keys.

  1. The app registers. POST /v1/connected-apps with its two public keys, signed by its own key. The reply holds the approval code and when the pending approval expires, five minutes after registration.
  2. The app shows the code, and the owner types it into the web app. The web app never fills the code in for them.
  3. The owner approves with a passkey. The web app shows when and roughly where the app registered before they do.
  4. The app polls. GET /v1/connected-apps/{appId}/approval answers {"status":"pending"} until the approval, and then {"status":"approved","userId":"…","generation":"…"}.
  5. The app fetches its grant. GET /v1/connected-apps/{appId}/grant returns the owner’s signed approval, the account’s files key wrapped for the app’s X25519 key, and the account’s recovery signing public key.

While its approval is pending, the app’s signature carries no account, and it reaches only its own registration and approval. From the approval on, every request names the account: the userId and generation from step 4 go into the VoidFS-Account and VoidFS-Generation headers, which the signature covers.

A credential that no longer admits its caller (an unknown, revoked or expired app) answers 401 with the problem connected-app-unavailable.

Next: Signing requests.