defineService and route to the endpoint handlers, the AFAuth protocol endpoints self-verify — you don’t call the verifier yourself. You reach for it directly in two cases:
- Fronting a backend — an edge proxy or service-mesh sidecar that checks the signature, then forwards to an unaware backend (Appendix E).
- Guarding your own business endpoints — your
/api/*routes, not the AFAuth protocol routes. Useserver.verifyAttestedthere if you also want a liveness gate; use the bareVerifierif you only need the signature.
Verify the signature
Verifier performs §5.5 + §5.6 — signature parsing, key resolution, the Ed25519 check, and the timestamp + nonce checks — with no network I/O, since agent identifiers are did:key and the key decodes straight from the DID:
verify returns the verified identity on success and throws an AFAuthError on any failure — .toResponse() renders the error envelope. The runnable version is examples/recipes/verify.ts.
What a failure means
Every verification failure is a401 with a specific code:
The full set is in the error-code reference.
Two things production needs
- Supply a durable revocation list. §8.3 requires one; the
Memory*stores reset on restart. - Hand the verifier the exact bytes you received. The signed
Content-Digestcovers the raw body — don’t let JSON re-serialization in your stack mangle it before verification.
Where to next
Signing requests
What’s in the signature and the seven verification steps.
Keep attested access live
Add a §10.7 liveness gate with
verifyAttested.Error codes
Every code, status, and trigger.
Rate limiting
Cap request volume per agent and per human.