
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@peac/protocol
Advanced tools
Receipt issuance and verification for the PEAC protocol.
pnpm add @peac/protocol
@peac/protocol is Layer 3 of the PEAC protocol stack. It provides the high-level issue() and verifyLocal() APIs for creating and verifying signed interaction receipts in the Interaction Record format. It handles schema validation, kernel constraint enforcement, JOSE hardening, strictness profiles, policy binding, and structured error reporting.
import { issue, generateKeypair } from '@peac/protocol';
const { privateKey, publicKey } = await generateKeypair();
const result = await issue({
iss: 'https://example.com',
kind: 'evidence',
type: 'org.peacprotocol/commerce',
privateKey,
kid: 'key-1',
pillars: ['commerce'],
extensions: {
'org.peacprotocol/commerce': {
rail: 'stripe',
amount_minor: '1000',
currency: 'USD',
event: 'authorization',
},
},
});
console.log(result.jws); // compact JWS string
import { verifyLocal } from '@peac/protocol';
const result = await verifyLocal(jws, publicKey, {
issuer: 'https://example.com',
strictness: 'strict',
});
if (result.valid) {
console.log(result.claims.type); // 'org.peacprotocol/commerce'
console.log(result.claims.kind); // 'evidence'
console.log(result.kid); // 'key-1'
console.log(result.warnings); // VerificationWarning[]
console.log(result.policy_binding); // 'unavailable' | 'verified'
} else {
console.log(result.code); // e.g., 'E_INVALID_SIGNATURE'
console.log(result.message);
}
import { verifyLocal, computePolicyDigestJcs } from '@peac/protocol';
const policyDoc = { rules: [{ action: 'allow', resource: '/api/*' }] };
const digest = await computePolicyDigestJcs(policyDoc);
const result = await verifyLocal(jws, publicKey, {
policyDigest: digest,
});
if (result.valid) {
console.log(result.policy_binding); // 'verified' if receipt policy matches
}
import { verifyLocal } from '@peac/protocol';
// 1. Resolve issuer's /.well-known/peac-issuer.json -> jwks_uri -> public key
// 2. Pass the resolved key to verifyLocal()
const result = await verifyLocal(jws, resolvedPublicKey, {
issuer: 'https://api.example.com',
});
if (result.valid) {
console.log(result.claims.iss);
}
@peac/kernel (Layer 0): Constants, types, and error codes@peac/schema (Layer 1): Zod schemas and claim validation@peac/crypto (Layer 2): Ed25519 signing and JWS creation (re-exported for convenience)@peac/mcp-server (Layer 5): MCP tool server built on this package@peac/adapter-* and @peac/mappings-* packages (Layer 4)If you are building an AI agent or MCP server that needs signed interaction receipts:
@peac/mcp-server for a ready-to-use MCP tool serverissue() to create receipts and verifyLocal() to verify them when you have the public keygenerateKeypair, base64urlEncode, sha256Hex, verify) are re-exported from @peac/crypto so a single import is sufficient for most workflowsApache-2.0
PEAC Protocol is an open source project stewarded by Originary and community contributors.
FAQs
PEAC protocol implementation - receipt issuance and verification
The npm package @peac/protocol receives a total of 16 weekly downloads. As such, @peac/protocol popularity was classified as not popular.
We found that @peac/protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.