
Security News
White House Authorizes Private Companies to Conduct Offensive Cyber Operations
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.
@peac/contracts
Advanced tools
Canonical error codes and verification mode contracts for PEAC Protocol.
This package is the single source of truth for error codes, HTTP status mappings, and verification mode behavior. All surface implementations (workers, middleware) MUST import from this package to prevent contract drift.
pnpm add @peac/contracts
import {
CANONICAL_ERROR_CODES,
CANONICAL_STATUS_MAPPINGS,
MODE_BEHAVIOR,
problemTypeFor,
ERROR_CATALOG,
type PeacErrorCode,
type VerificationMode,
} from '@peac/contracts';
// Get HTTP status for an error code
const status = CANONICAL_STATUS_MAPPINGS[CANONICAL_ERROR_CODES.TAP_SIGNATURE_INVALID];
// 401
// Get RFC 9457 Problem Details type URI
const problemType = problemTypeFor(CANONICAL_ERROR_CODES.TAP_SIGNATURE_INVALID);
// "https://www.peacprotocol.org/problems/E_TAP_SIGNATURE_INVALID"
// Check verification mode behavior
const modeBehavior = MODE_BEHAVIOR.tap_only;
// { noTapHeadersStatus: 401, noTapHeadersCode: 'E_TAP_SIGNATURE_MISSING' }
// Get error catalog entry
const catalogEntry = ERROR_CATALOG[CANONICAL_ERROR_CODES.TAP_SIGNATURE_INVALID];
// { status: 401, title: 'Invalid Signature', defaultDetail: '...' }
PeacErrorCode - Union type of all canonical error codes (compile-time safety)VerificationMode - Union type: 'tap_only' | 'receipt_or_tap'ErrorCatalogEntry - Structure for error catalog entriesCANONICAL_ERROR_CODES - All error codes with E_* prefixCANONICAL_STATUS_MAPPINGS - Error code → HTTP status mappingsCANONICAL_TITLES - Error code → RFC 9457 title mappingsMODE_BEHAVIOR - Verification mode → missing TAP behaviorWWW_AUTHENTICATE_STATUSES - HTTP statuses requiring WWW-Authenticate header [401, 402]ERROR_CATALOG - Full error catalog with status, title, and default detailPROBLEM_TYPE_BASE - Base URI for Problem Details type fieldproblemTypeFor(code: PeacErrorCode): string - Get RFC 9457 type URI for error codegetStatusForCode(code: PeacErrorCode): number - Get HTTP status for error coderequiresWwwAuthenticate(status: number): boolean - Check if status requires WWW-AuthenticateAll error codes use the E_* prefix format:
E_RECEIPT_MISSING - Receipt required but not providedE_RECEIPT_INVALID - Receipt validation failedE_RECEIPT_EXPIRED - Receipt has expiredE_TAP_SIGNATURE_MISSING - TAP headers missingE_TAP_SIGNATURE_INVALID - Signature verification failedE_TAP_TIME_INVALID - Signature time invalidE_TAP_KEY_NOT_FOUND - Signing key not foundE_TAP_REPLAY_PROTECTION_REQUIRED - Replay protection required but not configuredE_TAP_WINDOW_TOO_LARGE - Time window exceeds maximumE_TAP_TAG_UNKNOWN - Unknown signature tagE_TAP_ALGORITHM_INVALID - Invalid signature algorithmE_ISSUER_NOT_ALLOWED - Issuer not in allowlistE_TAP_NONCE_REPLAY - Nonce replay detectedE_CONFIG_ISSUER_ALLOWLIST_REQUIRED - ISSUER_ALLOWLIST required but not configuredE_INTERNAL_ERROR - Internal server errortap_only (Default)Missing TAP headers → 401 + E_TAP_SIGNATURE_MISSING
receipt_or_tapMissing TAP headers → 402 + E_RECEIPT_MISSING (payment remedy)
This package guarantees:
PeacErrorCode union type prevents invalid codesApache-2.0
PEAC Protocol is an open source project stewarded by Originary and community contributors.
FAQs
PEAC canonical error codes and verification mode contracts
The npm package @peac/contracts receives a total of 259 weekly downloads. As such, @peac/contracts popularity was classified as not popular.
We found that @peac/contracts 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.

Security News
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

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.