A credentials and token-authentication service, with state. Two APIs (mTLS management + auth), opaque server-side tokens, multi-engine schema — all from config + rules, without a line of bespoke code.
One listener per process → two instances sharing the SAME database (busy_timeout + WAL). Management behind mTLS: only a valid client certificate administers. Token issuance stays on the public surface.
Dual model: client_id+secret_key or username+password. The token is OPAQUE (uuid), stored hashed (sha256) with its expiry; the secret with password_hash (bcrypt). Neither the clear token nor the clear secret is persisted.
create · list · get · update (enable/disable) · delete · rotate · revoke-tokens
opaque token (200/401) · introspect (RFC 7662) · token/signed (JWT EdDSA) · token/pairwise (JWT HS256 + @hkdf) · voucher (JWE A256GCM)
regenerates the secret and returns it; the old one stops working
UPDATE revoked_at → forces renegotiation
All three are deployment configuration, not code, and all three are E2E-tested. In scenario 3 the signed .nap package travels WHOLE: the host mounts it with packages:, its endpoints serve the extracted rules and the local DSN satisfies the manifest's logical connection. Management (mTLS) is not embedded: it runs separately over the same DB only when administration is needed.
JWT HS256 signed with a working key derived via @hkdf(root, pair, epoch) — the root is never used directly; rotating the epoch = rotating parametry. HMAC ~µs: the cheapest option. Only between infrastructure you own.
The token stays OPAQUE; Tessera hands over the validity material encrypted (JWE A256GCM) and the delegate persists it in its context (sql backend): it validates locally, survives restarts and a downed Tessera — one @send only on the first miss.
JWT EdDSA: Tessera signs with its private key (never leaves); each delegate verifies with the cached PUBLIC key — the delegated party cannot forge. One key for everyone; rotation via kid/JWKS.
require_auth · require_auth_pairwise · require_auth_voucher — copied in front of any consumer's business logic; denial (code and payload) config-driven, never hardcoded.
@DbList strips the sensitive columns declared in config (clients:[secret_hash]) — the list never leaks hashes. The implementer decides.
secret → bcrypt (password_hash); token → sha256 (hash_hex). Verified with password_verify.
the internal API requires a client certificate (require_mtls); auth stays public.
secret/token/hashes masked; metadata logged, never sensitive material.
All from config + transformation rules over existing directives: @uuid, @password_hash/@password_verify, @hash_hex, @now_unix, @Sum, and the DB ones @DbFindRow/@DbInsertRow/@DbUpdateRow/@DbDeleteRow/@DbList. What was added to the engine —generic and reusable— was @DbList with redaction, the native in-process SQLite driver and, with the delegated variants, HS256 in @jose_sign/@jose_verify and field-vs-field conditions in When (%ref resolution on the right-hand side).
Native in-process SQLite for testing (self-contained; also enables persistent contexts without a plugin). Per-engine schema scripts; clean clients/tokens tables.