How Do I...
Quick answers to common tasks. Each answer includes a code snippet and a link to the full guide.
Verify a receipt?
Three ways to verify:
CLI:
Terminal
npx peac verify eyJhbGciOiJFZERTQSIs... --issuer https://api.example.com
MCP Server (via AI agent):
MCP tool call
{ "tool": "peac_verify", "arguments": { "receipt": "eyJ...", "issuer_url": "https://api.example.com" } }
Programmatic:
verify.ts
import { verifyReceipt } from '@peac/protocol';
const result = await verifyReceipt(receipt, { issuerUrl: 'https://api.example.com' });
See: Verification | CLI Reference | MCP Server
Issue a receipt?
issue.ts
import { issueReceipt } from '@peac/protocol';
const receipt = await issueReceipt({
privateKey: process.env.PEAC_PRIVATE_KEY,
kid: 'peac-2026-02',
claims: {
iss: 'https://api.example.com',
sub: 'user:agent-123',
peac: { type: 'api.request', attestation_type: 'interaction', status: 'executed' },
},
});
Or use Express middleware for automatic issuance:
express.ts
import { peacMiddleware } from '@peac/middleware-express';
app.use(peacMiddleware({ privateKey, kid, issuer }));
See: Quickstart | Express Middleware
Add receipts to my MCP server?
Use @peac/mappings-mcp to attach evidence to MCP tool responses via _meta fields:
mcp-attach.ts
import { attachMcpCarrier } from '@peac/mappings-mcp';
const toolResponse = attachMcpCarrier(originalResponse, {
receipt_ref: 'sha256:abc123...',
receipt_jws: 'eyJhbGciOiJFZERTQSIs...',
});
See: Agent Protocols | MCP Server
Carry evidence through A2A?
Use @peac/mappings-a2a to attach and extract evidence from A2A metadata:
a2a-attach.ts
import { attachA2aCarrier, extractA2aCarrier } from '@peac/mappings-a2a';
const artifact = attachA2aCarrier(originalArtifact, {
receipt_ref: 'sha256:abc123...',
receipt_jws: 'eyJhbGciOiJFZERTQSIs...',
});
const carrier = extractA2aCarrier(incomingMessage);
See: A2A Integration | Evidence Carrier
Record payment evidence?
Use the appropriate rail adapter:
payment.ts
import { fromX402Payment } from '@peac/rails-x402';
const evidence = fromX402Payment({ paymentHeader, amount: '0.001', currency: 'USDC', network: 'base' });
import { fromStripePaymentIntent } from '@peac/rails-stripe';
const evidence2 = fromStripePaymentIntent(paymentIntent);
See: Payment Rails | x402 Integration
Observe content signals?
signals.ts
import { parseRobotsTxt, parseTdmRep, resolveSignals } from '@peac/mappings-content-signals';
const robots = parseRobotsTxt(robotsTxtContent, 'PEACBot');
const tdmrep = parseTdmRep(tdmrepJsonContent);
const observation = resolveSignals({ robotsTxt: robots, tdmRep: tdmrep });
// { train: 'deny', search: 'allow', inference: 'unspecified', ... }
See: Content Signals
Test conformance?
Terminal
# Run basic conformance
npx peac conformance run --level basic
# Run full conformance suite
npx peac conformance run --level full --issuer https://api.example.com
See: Conformance Levels | CLI Reference
Create an evidence bundle?
CLI:
Terminal
npx peac bundle create --receipts r1.jws r2.jws --issuer https://api.example.com --output evidence.peac.tar.gz
MCP Server:
MCP tool call
{ "tool": "peac_create_bundle", "arguments": { "receipts": ["<jws1>", "<jws2>"], "issuer_url": "https://api.example.com" } }
See: Evidence Bundles | CLI Reference
Record inference evidence?
inference.ts
import { fromChatCompletion } from '@peac/adapter-openai-compatible';
const evidence = fromChatCompletion(response, { messages });
// SHA-256 digests only -- no raw text stored
See: Inference Receipts