v0.9.23
Quickstart
Add cryptographic receipts to your API in 5 minutes. Prove every access, payment, and policy compliance.
Prerequisites
- -Node.js 20+
- -TypeScript (recommended)
- -pnpm, npm, or yarn
1. Install
$ pnpm add @peac/protocol @peac/crypto @peac/schemaOr use @peac/sdk for an all-in-one package.
2. Implement
import { issue } from '@peac/protocol'
import { generateKeypair } from '@peac/crypto'
// Generate or load your key pair
const { privateKey } = await generateKeypair()
// Issue a receipt
const { jws } = await issue({
iss: 'https://api.example.com',
aud: 'https://client.example.com',
amt: 100,
cur: 'USD',
payment: {
rail: 'x402',
facilitator: 'daydreams'
},
privateKey,
kid: 'peac-2025-12'
})
// Add to response
res.setHeader('PEAC-Receipt', jws)3. Publish JWKS
Serve your public key at /.well-known/jwks.json:
{
"keys": [{
"kty": "OKP",
"crv": "Ed25519",
"use": "sig",
"kid": "peac-2025-12",
"x": "base64url-encoded-public-key",
"alg": "EdDSA"
}]
}4. Go-Live Checklist
1.Create /.well-known/peac-policy.yaml policy file
2.Publish JWKS at /.well-known/jwks.json
3.Add PEAC-Receipt header to responses
4.Implement key rotation strategy
5.Configure issuer allowlist
6.Set Cache-Control headers for policy files
7.Test receipt verification in client apps
Payment Rails
PEAC supports multiple payment rails with unified receipt verification:
x402
@peac/rails-x402HTTP 402 with v2 protocol support
Stripe
@peac/rails-stripeCheckout, Payment Intents, webhooks
Card
@peac/rails-cardGeneric card billing bridge
Agent Protocols
Integrate with AI agent and commerce protocols:
MCP
@peac/mappings-mcpModel Context Protocol budget utilities
ACP
@peac/mappings-acpAgentic Commerce Protocol mapping
TAP
@peac/mappings-tapVisa Trusted Agent Protocol
RSL
@peac/mappings-rslRobots Specification Language alignment