API Call Records
PEAC records evidence for HTTP API calls: what terms applied, what was requested, and what the outcome was. The issuer is the server; verifiers are any downstream party with the issuer's public key.
How it works
- Your API server has an Ed25519 signing key and publishes a JWKS at
/.well-known/peac-issuer.json - On each response, call
issue()from@peac/protocolto produce a signed JWS - Return the JWS in the
PEAC-Receiptresponse header - Any party with your public key can verify the record offline
import { issue } from '@peac/protocol';
const record = await issue({
iss: 'https://api.example.com',
sub: 'user:abc123',
typ: 'access',
}, privateKey);
res.setHeader('PEAC-Receipt', record);
Express middleware (automatic issuance)
npm install @peac/middleware-express
import { peacMiddleware } from '@peac/middleware-express';
app.use(peacMiddleware({ privateKey, issuer: 'https://api.example.com' }));
Every response automatically gets a signed PEAC-Receipt header.
What gets recorded
- Issuer identity (
iss) -- who signed the record - Subject (
sub) -- caller or resource identifier - Interaction type (
typ) -- access, attribution, consent, commerce, etc. - Extension claims in
ext[]-- structured evidence from registered extension groups - Timestamp and optional expiry
What does NOT get recorded
PEAC does not store raw request bodies, response payloads, session tokens, or credentials. It records structured interaction evidence only.