Repository navigation
Releases
Releases · dophq/dopgate
Dopgate 0.1.0
Summary
The first release: an auth server for one app that signs in people and AI
agents, backed by PostgreSQL, with an admin console and a Docker image.
Nothing below has shipped before.
Added
- The
dopgatebinary:serve,init,keys rotate, andhealthcheck.
Settings come fromDOPGATE_*variables, with an optional TOML file. - PostgreSQL storage through
DOPGATE_DATABASE_URL. Every table lives in the
dopgateschema (DOPGATE_DATABASE_SCHEMA), so it can share your app's
database. - Root setup:
DOPGATE_ROOT_EMAILon a fresh database prints a generated
password once; otherwise a one-time setup token,/setup, ordopgate init.
initasks for the email and password on a terminal. Without one, as in a
script or CI, it exits 1 and names the flag or variable to use instead of
waiting for an answer. - Sign-up, sign-in by password or emailed 6-digit code, sign-out, profile
(displayName,avatarUrl,userMetadata), password change, and email
change. - Email verification and password reset by code. Sign-in requires a verified
email by default (signup.requireEmailVerification). - ES256 access tokens with
/.well-known/jwks.json, key rotation, and
single-use refresh tokens that end the session when reused. Tokens carry
kind(humanoragent) and no role. - Access tokens carry
aud, the same public URL asiss, andjti, an ID
of their own. Checkaudin your backend next toiss; some JWT libraries
refuse a token with an audience unless you name the one you expect. GET /.well-known/openid-configurationreturns a discovery document with
issuerandjwks_uri, so an API gateway or a JWT library can find the
key set from the issuer URL alone. Dopgate is still not an OpenID Connect
provider.tokens.refreshReuseSeconds, 10 by default: a spent refresh token sent
again within that many seconds gets the session's newest refresh token
instead of ending the session, so two tabs or a retried request don't sign
anyone out.0turns it off. The console has the field under Settings.- Sessions: list devices and sign out one or all at
/api/v1/auth/sessions. - Admins are separate from your app's users. Root and admins have
adm_IDs
and their own sessions and codes, and sign in to the console only, at
/api/v1/console. Their tokens are signed with an internal key that isn't
in the JWKS, so no backend can accept them. The same email can belong to an
admin and a user. Rotating keys retires the console key on every server at
once. - Admin API for users: search, create, update metadata, disable, delete, send
reset codes, and sign out of every device or of one
(DELETE /api/v1/admin/users/{id}/sessions/{sessionId}). Admins and
DOPGATE_SERVICE_KEYcan use it. publicMetadatatravels in a person's access token as the
public_metadataclaim, so your backend can read a role or a plan without
calling Dopgate. The claim is left out when the object is empty, and a
change reaches the token on the next refresh.publicMetadatais limited
to 1 KB;userMetadataandprivateMetadatakeep 16 KB and stay out of
the token.- Root manages admins at
/api/v1/admin/admins; admins and the service key
can read the list. - Personal tokens (
dgp_) let a user sign in as themselves from a script.
Users make them at/api/v1/auth/personal-tokensonce an admin turns on
selfService.personalTokens, and trade them atPOST /api/v1/auth/token
for an access token withvia: "pat". Tokens can expire, are capped per
user, and admins can list and revoke them without seeing them. - Agents (
agt_) are accounts for bots and AI agents. Each belongs to an
admin or a user, signs in only by trading its onedga_token at
/api/v1/auth/token, and carries flat key-value capabilities that land in
its access token next tokind: "agent"andowner. Admins make agents in
the console; users make their own at/api/v1/auth/agentsonce
selfService.agentsis on. Disabling or deleting an owner stops or
removes their agents. - Six email templates with built-in defaults that admins can edit, preview,
test, and reset at/api/v1/admin/email-templates. - New passwords are checked against passwords known from data breaches, the
way NIST 800-63B asks. Dopgate sends the first five characters of the
password's SHA-1 hash to Pwned Passwords and compares the answer itself, so
the password never leaves your server. A listed password answers
422 PASSWORD_LEAKED. A list that can't be reached never blocks a
password.password.rejectLeakedturns it off, and the console has the
switch under Settings.DOPGATE_LEAKED_PASSWORDS_URLpoints the check at a
mirror of the list. - Limits: per-address and per-email request limits, code resend waits, and
account lockout after five wrong passwords, all editable in settings.
Sending a code answers withretryAfter, the seconds until the next one,
and the console's sign-in page counts it down. - Password hashes run one per CPU at a time and the rest wait in line, so a
burst of sign-ins doesn't take 19 MiB each at once. On glibc the memory of
a finished hash goes back to the system. GET /api/v1/admin/users?email=finds the one user with that email.
searchmatches part of an email, so it can't tellana@fromhana@.- A backend that signs people in for them can send the service key in
X-Dopgate-Backend-Keywith the visitor's address and browser in
X-Dopgate-Client-IPandX-Dopgate-Client-Agent. Limits, the device
list and the audit log then show the visitor instead of the backend. A
wrong key answers401 BACKEND_KEY_INVALID, a code of its own, so a
backend can tell its setup error from a visitor's wrong password. - Error messages say what happened in plain words and name none of
Dopgate's routes, so an app can show them to the person as they are. - SMTP through
DOPGATE_SMTP_*, or from the console whenDOPGATE_SMTP_HOST
is empty. The environment wins over the console, and with neither, emails
go to the log. A password saved in the console is encrypted with a key
fromDOPGATE_SERVICE_KEY. The sender defaults tono-reply@dopgate.com. testEmail.recipientsets where the SMTP test and template tests go.
Until someone saves an address, they go to root, no matter who sends them.
The service key can send them too. The console has the field next to Send
test email under Settings. A one-offtostill works on the SMTP test.- A hash-chained audit log with retention (
DOPGATE_AUDIT_RETENTION_DAYS,
365 days by default) and a verify endpoint. - The admin console at
/: users, agents, admins, email templates,
settings, signing keys, audit log, and your account. Admins sign in to it at
/api/v1/console; your app's users can't. Every page works on a phone and
a tablet: lists become cards below 640px, and Settings has a list of its
sections that marks the ones with unsaved edits. An audit event opens in a
drawer with its UTC time, metadata and place in the hash chain, and user and
agent pages link to what they did in the audit log. - The Dopgate brand: the Hash D logo, Gate Red, and the Geist wordmark across
the console, docs, README, and favicons. The server banner and
dopgate --helpprint the line "Modern auth for people and AI agents". - CORS for the origins in
DOPGATE_ALLOWED_ORIGINS. - A
Dockerfileand adocker-compose.ymlwith PostgreSQL 18 and Dopgate.
The image carries OCI labels for its title, source, and license. - Release archives of the
dopgatebinary for Linux and macOS, on amd64 and
arm64, with achecksums.txtto verify them. Each GitHub release takes its
notes from this file. - A Docker image for every release at
dopbase/dopgateon Docker Hub, for
linux/amd64 and linux/arm64, tagged with the version, its minor line (0.1), and
latest. It holds the same static binary as the Linux release archive on
a distroless base, runs as a non-root user, and has no shell. - Documentation site and README for the setup above. The docs have an AI
agents section and cover personal tokens, console tokens, and starting over
from a development build. The home page links each feature to its guide and
walks through the four steps from an empty database to a verified token. - A benchmarks page with measured requests per
second, latency, and memory.bun run benchrepeats the run in Docker. - A guide for web apps with a backend: the backend signs people in through
Dopgate and keeps both tokens in an encrypted HttpOnly cookie, so no
long-lived token reaches the browser and Dopgate can run on any domain. - Single sign-on and MFA routes answer
501 NOT_IMPLEMENTEDuntil they are
built. They are hidden from the API docs at/api/docsfor now.
Security
- Wrong current passwords on password and email changes count toward the
per-address limit and the account lockout, so a stolen access token can't
be used to guess the password. - An account without a password needs an emailed reset code to set one, so a
stolen access token alone can't add a password and keep the account. The
console's Account page asks for the code. - A value sent to
/api/v1/auth/tokenthat isn't adgp_ordga_token is
recorded astoken.rejectedwithout any of its characters. Before, its
last four were kept, which could be the end of a password pasted into the
wrong field.
Full Changelog: https://github.com/dopbasehq/dopgate/commits/0.1.0