Skip to content
v0.12.0

Quickstart

Add verifiable interaction records to your API in 5 minutes. Generate portable evidence for access decisions, settlement references, and applied terms.

Prerequisites

  • -Node.js 22+
  • -TypeScript (recommended)
  • -pnpm, npm, or yarn

1. Install

$ pnpm add @peac/protocol @peac/crypto @peac/schema

These three packages cover issuance and verification. For Express middleware, also add @peac/middleware-express.

2. Implement

import { issueWire02 } from '@peac/protocol'
import { generateKeypair } from '@peac/crypto'

// Generate or load your key pair
const { privateKey } = await generateKeypair()

// Issue an interaction record (Interaction Record Format 0.2)
const { jws } = await issueWire02({
  iss: 'https://api.example.com',
  kind: 'evidence',
  type: 'org.peacprotocol/payment',
  pillars: ['commerce'],
  extensions: {
    'org.peacprotocol/commerce': {
      payment_rail: 'x402',
      amount_minor: '10000',
      currency: 'USD',
    },
  },
  privateKey,
  kid: 'peac-2026-03',
})

// Add receipt to response
res.setHeader('PEAC-Receipt', jws)

3. Publish Keys

Serve your public key at /.well-known/jwks.json and create an issuer configuration at /.well-known/peac-issuer.json that points to it via jwks_uri:

{
  "keys": [{
    "kty": "OKP",
    "crv": "Ed25519",
    "use": "sig",
    "kid": "peac-2026-03",
    "x": "base64url-encoded-public-key",
    "alg": "EdDSA"
  }]
}

Then create /.well-known/peac-issuer.json:

{
  "version": "peac-issuer/0.1",
  "issuer": "https://api.example.com",
  "jwks_uri": "https://api.example.com/.well-known/jwks.json",
  "receipt_versions": ["peac-receipt/0.1", "interaction-record+jwt"],
  "algorithms": ["EdDSA"]
}

4. Go-Live Checklist

1.Create peac-policy.yaml and compile to /.well-known/peac.txt
2.Publish JWKS at /.well-known/jwks.json
3.Publish issuer config at /.well-known/peac-issuer.json with jwks_uri
4.Add PEAC-Receipt header to responses
5.Implement key rotation strategy
6.Configure issuer allowlist
7.Set Cache-Control headers for policy and issuer files
8.Test receipt verification in client apps

Payment Rails

PEAC supports multiple payment rails with unified receipt verification:

x402@peac/rails-x402

HTTP 402 with v0.2 profile and DoS guards

Payment Gateways@peac/rails-stripe

Stripe with x402 crypto bridge

Razorpay@peac/rails-razorpay

India payments: UPI, cards, netbanking

Card@peac/rails-card

Generic card billing bridge

Agent Protocols

Integrate with AI agent and commerce protocols:

MCP@peac/mappings-mcp

Model Context Protocol tool call mapping

A2A@peac/mappings-a2a

Agent-to-Agent evidence carrier

ACP@peac/mappings-acp

Agent Communication Protocol mapping

UCP@peac/mappings-ucp

Universal Commerce Protocol mapping

TAP@peac/mappings-tap

Trusted Agent Protocol mapping

RSL@peac/mappings-rsl

Rights Specification Language mapping

AIPREF@peac/mappings-aipref

IETF AI Preferences vocabulary

Signals@peac/mappings-content-signals

Content use policy signal observation

Next Steps