ochk.io · auth host API
The orangecheck family auth host. Issues Ed25519-signed oc_session cookies
(Domain=.ochk.io) that every consumer subsite verifies locally via
@orangecheck/auth-core +
@orangecheck/auth-client — no DB on consumers, no
per-request fetch to the auth host.
Live spec & interactive explorer. The canonical contracts are at
https://ochk.io/api/openapi (opens in a new tab) (OpenAPI 3.1
JSON, CORS-permissive, cached 5 min) and
https://ochk.io/api-explorer (opens in a new tab) (Swagger UI
with "Try it out" enabled). Generate clients with
openapi-generator-cli generate -i https://ochk.io/api/openapi -g <lang>.
Surface mapLink to this section
| Tag | Endpoints | Purpose |
|---|---|---|
auth | /, /, /, /, /, / | Session lifecycle. JWT verification key, current session, sign-in/out, multi-account switch, account edit. |
challenge | / (GET + POST) | BIP-322 signed-challenge primitive — issue + verify, the building block. |
email- | /, / | Email-OTP sign-in. Same session-cookie outcome as BIP-322. |
oauth | /, /, / | Google / GitHub sign-in run on the auth host. Same session-cookie outcome; / lists the configured providers. |
connect | /, /, /, / | OC Connect — provision a did: for an integrator's own users, hand them a claim link, delete them; register apps. See OC Connect. |
public | / | Cross-subdomain family-wide stats. No auth. |
forms | / | Contact-form relay via Resend. Same-origin only. |
Auth schemeLink to this section
cookieAuth — the oc_session cookie issued by /api/auth/signin (or
/api/auth/email-otp/verify). Cookie attributes:
Domain=.ochk.io(cross-subdomain)HttpOnly(no JS access)Secure(TLS only)SameSite=None(so sibling subdomains can set it by credentialed fetch). The CSRF gate is an origin check: a cookie session on an unsafe method is refused unless the request comes from the same origin or a listed family site.
Consumer sites verify locally — no fetch to the auth host on every request. The
Ed25519 public JWK lives at /api/auth/jwks (opens in a new tab)
and /.well-known/jwks.json; consumers cache it as the OC_AUTH_PUBLIC_JWK env
var at deploy time.
Sign-in primitivesLink to this section
Three paths, one outcome — each lands the same oc_session cookie, so
consumer code never branches on how the user signed in.
BIP-322 (canonical):
GET /api/challenge?addr=...&audience=...&purpose=login→{ message, nonce, expiresAt, expiresAtIso }. Theaudiencemust be the auth host, a family site or a first-party site; only then is the challenge recorded for sign-in.- User signs
messagewith their Bitcoin wallet via@orangecheck/wallet-adapteror directly. POST /api/auth/signinwith{ message, signature, expectedNonce, expectedAudience, expectedPurpose: "login" }(plus optionalscheme:"bip322"or"legacy", andadd) → 200{ ok, token, account }+oc_sessioncookie set. The nonce works once.
Email-OTP (lower-friction):
POST /api/auth/email-otp/startwith{ email }→ server emails a 6-digit code and answers{ ok, token, expires_at }.POST /api/auth/email-otp/verifywith{ email, code, token }(plus optionaladd) → 200{ ok, token, account }+oc_sessioncookie set.
OAuth providers (Google / GitHub):
GET /api/auth/<provider>/start→ redirect to the provider's consent screen.- The provider redirects back to
/api/auth/<provider>/callback; the auth host verifies the result and sets theoc_sessioncookie. GET /api/auth/providerslists which providers are configured — this is what<OcSignIn>reads to render its provider buttons.
A provider sign-in mints the same orangecheck-held account that email-OTP does — neither path gives the user a signing key of their own. Federation custody is the design for those accounts and is not live; see federation custody. For layering orangecheck onto an integrator's own OAuth instead, see OC Connect.
Multi-account sign-inLink to this section
Hold multiple orangecheck accounts in one browser and switch between them
without re-authenticating — same pattern as Google or GitHub. Three endpoints
touch this: POST /api/auth/signin?add=1 (and the email-OTP equivalent) brings
a new account into the browser's roster; POST /api/auth/switch flips the
active session; POST /api/auth/logout?scope=current signs out of just the
current account while keeping the rest of the roster alive. Full narrative at
Multi-account.
Live spec — embeddedLink to this section
The OAuth-provider (/api/auth/<provider>/*) and Connect (/api/connect/*)
endpoints are newer than the embedded OpenAPI document — their contracts are
documented under Integration and OC Connect until
the spec catches up.