@peac/kernel 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/carrier.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Evidence Carrier Contract types (DD-124)
2
+ * Evidence Carrier Contract types
3
3
  *
4
4
  * Pure TypeScript types for the universal evidence carry interface.
5
5
  * Zero runtime dependencies: this module exports only types.
@@ -8,7 +8,7 @@
8
8
  * UCP, x402, HTTP) carries PEAC receipts without kernel changes.
9
9
  */
10
10
  /**
11
- * Canonical HTTP header name for PEAC receipts (DD-127).
11
+ * Canonical HTTP header name for PEAC receipts.
12
12
  *
13
13
  * The wire token is exactly "PEAC-Receipt" (mixed-case, hyphenated).
14
14
  * This is the only valid spelling in conformance fixtures and attach() output.
@@ -17,10 +17,10 @@
17
17
  */
18
18
  export declare const PEAC_RECEIPT_HEADER: "PEAC-Receipt";
19
19
  /**
20
- * Canonical HTTP header name for receipt URL locator hint (DD-135).
20
+ * Canonical HTTP header name for receipt URL locator hint.
21
21
  *
22
22
  * HTTPS-only, max 2048 chars, no credentials.
23
- * MUST NOT trigger implicit fetch (DD-55).
23
+ * MUST NOT trigger implicit fetch.
24
24
  */
25
25
  export declare const PEAC_RECEIPT_URL_HEADER: "PEAC-Receipt-URL";
26
26
  /** Content-addressed receipt reference: SHA-256 of the compact JWS bytes */
@@ -39,9 +39,9 @@ export interface PeacEvidenceCarrier {
39
39
  /** Compact JWS of the signed receipt (SHOULD for embed format) */
40
40
  receipt_jws?: string;
41
41
  /**
42
- * Locator hint for detached receipt resolution (DD-135).
42
+ * Locator hint for detached receipt resolution.
43
43
  * HTTPS-only, max 2048 chars, no credentials.
44
- * MUST NOT trigger implicit fetch (DD-55).
44
+ * MUST NOT trigger implicit fetch.
45
45
  * If a caller fetches, it MUST verify sha256(receipt_jws) == receipt_ref.
46
46
  */
47
47
  receipt_url?: string;
@@ -64,7 +64,7 @@ export interface PeacEvidenceCarrier {
64
64
  * Transport-level metadata describing how a carrier is placed.
65
65
  *
66
66
  * Used by validateConstraints() to enforce transport-specific size limits
67
- * and format requirements (DD-127).
67
+ * and format requirements.
68
68
  */
69
69
  export interface CarrierMeta {
70
70
  /** Transport identifier (e.g. 'mcp', 'a2a', 'acp', 'ucp', 'x402', 'http') */
@@ -82,7 +82,7 @@ export interface CarrierValidationResult {
82
82
  violations: string[];
83
83
  }
84
84
  /**
85
- * Protocol-specific carrier adapter (DD-124).
85
+ * Protocol-specific carrier adapter.
86
86
  *
87
87
  * Each protocol mapping implements this interface to attach/extract
88
88
  * PEAC evidence carriers in the protocol's native format.
@@ -105,7 +105,7 @@ export interface CarrierAdapter<TInput, TOutput> {
105
105
  */
106
106
  attach(output: TOutput, carriers: PeacEvidenceCarrier[], meta?: CarrierMeta): TOutput;
107
107
  /**
108
- * Validate a carrier against transport-specific constraints (DD-127, DD-129).
108
+ * Validate a carrier against transport-specific constraints.
109
109
  * Takes CarrierMeta for transport-aware size and format validation.
110
110
  */
111
111
  validateConstraints(carrier: PeacEvidenceCarrier, meta: CarrierMeta): CarrierValidationResult;
@@ -41,7 +41,7 @@ var DISCOVERY = {
41
41
  };
42
42
  var JWKS = {
43
43
  rotationDays: 90,
44
- /** Normative minimum overlap period (DD-148, v0.11.3+) */
44
+ /** Normative minimum overlap period (v0.11.3+) */
45
45
  overlapDays: 30,
46
46
  emergencyRevocationHours: 24
47
47
  };
@@ -162,6 +162,14 @@ var POLICY_BLOCK = {
162
162
  };
163
163
  var OCCURRED_AT_TOLERANCE_SECONDS = 300;
164
164
  var PEAC_ALG = ALGORITHMS.default;
165
+ var EXTENSION_BUDGET = {
166
+ /** Max UTF-8 bytes per extension group after JSON.stringify (64 KB) */
167
+ maxGroupBytes: 65536,
168
+ /** Max total UTF-8 bytes across all extensions after JSON.stringify (256 KB) */
169
+ maxTotalBytes: 262144,
170
+ /** Max UTF-8 bytes for any single string array field (32 KB) */
171
+ maxArrayPayloadBytes: 32768
172
+ };
165
173
  var CONSTANTS = {
166
174
  WIRE_TYPE,
167
175
  WIRE_VERSION,
@@ -184,6 +192,7 @@ exports.ALGORITHMS = ALGORITHMS;
184
192
  exports.BUNDLE_VERSION = BUNDLE_VERSION;
185
193
  exports.CONSTANTS = CONSTANTS;
186
194
  exports.DISCOVERY = DISCOVERY;
195
+ exports.EXTENSION_BUDGET = EXTENSION_BUDGET;
187
196
  exports.HASH = HASH;
188
197
  exports.HEADERS = HEADERS;
189
198
  exports.ISSUER_CONFIG = ISSUER_CONFIG;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";;;AAWO,IAAM,SAAA,GAAY;AASlB,IAAM,YAAA,GAAe;AAKrB,IAAM,UAAA,GAAa;AAAA,EACxB,SAAA,EAAW,CAAC,OAAO,CAAA;AAAA,EACnB,OAAA,EAAS;AACX;AAKO,IAAM,OAAA,GAAU;AAAA,EACrB,OAAA,EAAS,cAAA;AAAA,EACT,cAAA,EAAgB,sBAAA;AAAA,EAChB,IAAA,EAAM,MAAA;AAAA;AAAA,EAEN,OAAA,EAAS,cAAA;AAAA,EACT,cAAA,EAAgB,sBAAA;AAAA,EAChB,aAAA,EAAe;AACjB;AAQO,IAAM,MAAA,GAAS;AAAA,EACpB,YAAA,EAAc,uBAAA;AAAA,EACd,YAAA,EAAc,WAAA;AAAA,EACd,eAAA,EAAiB,iBAAA;AAAA,EACjB,eAAA,EAAiB,IAAA;AAAA,EACjB,QAAA,EAAU,MAAA;AAAA;AAAA,EACV,QAAA,EAAU;AACZ;AAQO,IAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY,+BAAA;AAAA,EACZ,aAAA,EAAe,iBAAA;AAAA,EACf,eAAA,EAAiB,IAAA;AAAA,EACjB,QAAA,EAAU,KAAA;AAAA;AAAA,EACV,QAAA,EAAU,CAAA;AAAA,EACV,cAAA,EAAgB;AAClB;AAKO,IAAM,SAAA,GAAY;AAAA,EACvB,cAAc,MAAA,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aAAA,GAAgB;AAAA,EAC3B,SAAA,EAAW,IAAA;AAAA,EACX,gBAAA,EAAkB,CAAC,OAAA,EAAS,KAAK,CAAA;AAAA;AAAA,EAEjC,YAAA,EAAc,EAAE,KAAA,EAAO,GAAA;AACzB;AAKO,IAAM,YAAA,GAAe,EAAE,SAAA,EAAW,GAAA;AAMlC,IAAM,YAAA,GAAe;AAAA;AAAA,EAE1B,YAAA,EAAc,IAAA;AAAA;AAAA,EAEd,gBAAA,EAAkB;AACpB;AAOO,IAAM,6BAAA,GAAgC;AAetC,IAAM,WAAW,UAAA,CAAW;AAS5B,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF","file":"constants.cjs","sourcesContent":["/**\n * PEAC Protocol Constants\n */\n\n/**\n * Wire 0.1 JWS `typ` claim (legacy constant name).\n *\n * @deprecated Use `WIRE_01_JWS_TYP` for new code. `WIRE_TYPE` and\n * `WIRE_01_JWS_TYP` resolve to the same string; `WIRE_01_JWS_TYP` is the\n * canonical name at the JWS layer (v0.12.0-preview.1+, Wire 0.2 dual-stack).\n */\nexport const WIRE_TYPE = 'peac-receipt/0.1' as const;\n\n/**\n * Wire 0.1 version string (legacy constant name).\n *\n * @deprecated Use `WIRE_VERSIONS` or compare against `WIRE_02_VERSION` for\n * dual-stack version detection. `WIRE_VERSION` remains valid for Wire 0.1\n * but does not participate in the Wire 0.2 version model.\n */\nexport const WIRE_VERSION = '0.1' as const;\n\n/**\n * Supported cryptographic algorithms\n */\nexport const ALGORITHMS = {\n supported: ['EdDSA'] as const,\n default: 'EdDSA' as const,\n} as const;\n\n/**\n * HTTP header names for PEAC protocol\n */\nexport const HEADERS = {\n receipt: 'PEAC-Receipt' as const,\n receiptPointer: 'PEAC-Receipt-Pointer' as const,\n dpop: 'DPoP' as const,\n // Purpose headers (v0.9.24+)\n purpose: 'PEAC-Purpose' as const,\n purposeApplied: 'PEAC-Purpose-Applied' as const,\n purposeReason: 'PEAC-Purpose-Reason' as const,\n} as const;\n\n/**\n * Policy manifest settings (/.well-known/peac.txt)\n *\n * Policy documents declare access terms for agents and gateways.\n * @see docs/specs/PEAC-TXT.md\n */\nexport const POLICY = {\n manifestPath: '/.well-known/peac.txt' as const,\n fallbackPath: '/peac.txt' as const,\n manifestVersion: 'peac-policy/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 262144, // 256 KiB\n maxDepth: 8,\n} as const;\n\n/**\n * Issuer configuration settings (/.well-known/peac-issuer.json)\n *\n * Issuer config enables verifiers to discover JWKS and verification endpoints.\n * @see docs/specs/PEAC-ISSUER.md\n */\nexport const ISSUER_CONFIG = {\n configPath: '/.well-known/peac-issuer.json' as const,\n configVersion: 'peac-issuer/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 65536, // 64 KiB\n maxDepth: 4,\n fetchTimeoutMs: 10000,\n} as const;\n\n/**\n * @deprecated Use POLICY instead. Will be removed in v1.0.\n */\nexport const DISCOVERY = {\n manifestPath: POLICY.manifestPath,\n manifestVersion: 'peac/0.9' as const,\n cacheTtlSeconds: POLICY.cacheTtlSeconds,\n} as const;\n\n/**\n * JWKS rotation and revocation settings\n */\nexport const JWKS = {\n rotationDays: 90,\n /** Normative minimum overlap period (DD-148, v0.11.3+) */\n overlapDays: 30,\n emergencyRevocationHours: 24,\n} as const;\n\n/**\n * Receipt validation constants\n */\nexport const RECEIPT = {\n minReceiptIdLength: 16,\n maxReceiptIdLength: 64,\n defaultTtlSeconds: 86400, // 24 hours\n} as const;\n\n/**\n * Payment amount validation limits (in cents/smallest currency unit)\n */\nexport const LIMITS = {\n maxAmountCents: 999999999999,\n minAmountCents: 1,\n} as const;\n\n/**\n * Bundle format version.\n * Used in dispute bundles, audit bundles, and archive bundles.\n */\nexport const BUNDLE_VERSION = 'peac-bundle/0.1' as const;\n\n/**\n * Verification report format version.\n */\nexport const VERIFICATION_REPORT_VERSION = 'peac-verification-report/0.1' as const;\n\n/**\n * Hash format constants and utilities.\n * All hashes use the self-describing format: sha256:<64 lowercase hex chars>\n */\nexport const HASH = {\n /** Canonical hash algorithm */\n algorithm: 'sha256' as const,\n\n /** Hash prefix pattern */\n prefix: 'sha256:' as const,\n\n /** Valid hash regex: sha256:<64 lowercase hex> */\n pattern: /^sha256:[0-9a-f]{64}$/,\n\n /** Hex-only pattern for legacy comparison */\n hexPattern: /^[0-9a-f]{64}$/,\n};\n\n/**\n * Parse a sha256:<hex> hash string into components.\n * Returns null if the format is invalid.\n *\n * @param hash - Hash string to parse (e.g., \"sha256:abc123...\")\n * @returns Parsed hash or null if invalid\n */\nexport function parseHash(hash: string): { alg: 'sha256'; hex: string } | null {\n if (!HASH.pattern.test(hash)) {\n return null;\n }\n return {\n alg: 'sha256',\n hex: hash.slice(7), // Remove 'sha256:' prefix\n };\n}\n\n/**\n * Format a hex string as a sha256:<hex> hash.\n * Validates that the hex is exactly 64 lowercase characters.\n *\n * @param hex - Hex string (64 lowercase characters)\n * @returns Formatted hash or null if invalid\n */\nexport function formatHash(hex: string): string | null {\n if (!HASH.hexPattern.test(hex)) {\n return null;\n }\n return `sha256:${hex}`;\n}\n\n/**\n * Validate a hash string is in the correct format.\n *\n * @param hash - Hash string to validate\n * @returns true if valid sha256:<64 hex> format\n */\nexport function isValidHash(hash: string): boolean {\n return HASH.pattern.test(hash);\n}\n\n/**\n * Verifier security limits per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_LIMITS = {\n /** Maximum receipt size in bytes (256 KB) */\n maxReceiptBytes: 262144,\n /** Maximum number of claims in a receipt */\n maxClaimsCount: 100,\n /** Maximum extension size in bytes (64 KB) */\n maxExtensionBytes: 65536,\n /** Maximum string length for individual claims (64 KB) */\n maxStringLength: 65536,\n /** Maximum JWKS document size in bytes (64 KB) */\n maxJwksBytes: 65536,\n /** Maximum number of keys in a JWKS */\n maxJwksKeys: 20,\n /** Maximum individual key size in bytes */\n maxKeySize: 4096,\n /** Network fetch timeout in milliseconds */\n fetchTimeoutMs: 5000,\n /** Maximum number of redirects to follow */\n maxRedirects: 3,\n /** Maximum network response size in bytes (256 KB) */\n maxResponseBytes: 262144,\n} as const;\n\n/**\n * Verifier network security settings per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_NETWORK = {\n /** Only allow HTTPS URLs */\n httpsOnly: true,\n /** Block requests to private IP ranges */\n blockPrivateIps: true,\n /** Default redirect policy (false = no redirects) */\n allowRedirects: false,\n} as const;\n\n/**\n * Private IPv4 CIDR blocks to block for SSRF protection\n */\nexport const PRIVATE_IP_RANGES = {\n /** RFC 1918 private ranges */\n rfc1918: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'] as const,\n /** Link-local addresses */\n linkLocal: ['169.254.0.0/16'] as const,\n /** Loopback addresses */\n loopback: ['127.0.0.0/8'] as const,\n /** IPv6 loopback */\n ipv6Loopback: ['::1/128'] as const,\n /** IPv6 link-local */\n ipv6LinkLocal: ['fe80::/10'] as const,\n} as const;\n\n/**\n * Verifier policy version\n */\nexport const VERIFIER_POLICY_VERSION = 'peac-verifier-policy/0.1' as const;\n\n/**\n * Verification modes per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFICATION_MODES = {\n /** All verification in browser/client, may fetch JWKS */\n clientSide: 'client_side' as const,\n /** No network access, uses bundled/pinned keys */\n offlineOnly: 'offline_only' as const,\n /** Prefer offline, fallback to network */\n offlinePreferred: 'offline_preferred' as const,\n /** Allow network fetches for key discovery */\n networkAllowed: 'network_allowed' as const,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Wire 0.2 constants (v0.12.0-preview.1, DD-156)\n// ---------------------------------------------------------------------------\n\n/**\n * JWS header typ value for Wire 0.1 receipts.\n * Canonical location: @peac/kernel (layer correction from @peac/schema).\n * The existing WIRE_TYPE constant is unchanged; both resolve to the same string.\n * @peac/schema re-exports this as PEAC_WIRE_TYP for backward compatibility.\n */\nexport const WIRE_01_JWS_TYP = 'peac-receipt/0.1' as const;\n\n/**\n * JWS header typ value for Wire 0.2 receipts (compact form).\n * Per RFC 7515 Section 4.1.9, the full media type form\n * 'application/interaction-record+jwt' is also accepted by verifiers and\n * normalized to this compact form before returning the header.\n */\nexport const WIRE_02_JWS_TYP = 'interaction-record+jwt' as const;\n\n/**\n * All accepted typ values for Wire 0.2 (compact + full media type form).\n * Used internally by @peac/crypto to fast-reject unrelated tokens.\n * Verifiers normalize the full form to WIRE_02_JWS_TYP before returning.\n */\nexport const WIRE_02_JWS_TYP_ACCEPT = [\n 'interaction-record+jwt',\n 'application/interaction-record+jwt',\n] as const;\n\n/**\n * Wire 0.2 peac_version payload claim value.\n * Discriminates Wire 0.2 envelopes from Wire 0.1 (which have no peac_version field).\n */\nexport const WIRE_02_VERSION = '0.2' as const;\n\n/**\n * All supported wire version strings for dual-stack implementations.\n */\nexport const WIRE_VERSIONS = ['0.1', '0.2'] as const;\n\n/**\n * TypeScript union type for supported wire version values.\n */\nexport type WireVersion = (typeof WIRE_VERSIONS)[number];\n\n/**\n * Canonical issuer (iss) constraints for Wire 0.2.\n * Supported schemes: 'https' (RFC 3986 origin-only) and 'did' (DID Core).\n * All other schemes produce E_ISS_NOT_CANONICAL.\n */\nexport const ISS_CANONICAL = {\n maxLength: 2048,\n supportedSchemes: ['https', 'did'] as const,\n /** Default port for https (rejected if explicit in iss). */\n defaultPorts: { https: 443 } as Record<string, number>,\n} as const;\n\n/**\n * type claim grammar constraints (open vocabulary: reverse-DNS or absolute URI).\n */\nexport const TYPE_GRAMMAR = { maxLength: 256 } as const;\n\n/**\n * policy block field constraints (Wire 0.2, DD-151).\n * Separate from ISS_CANONICAL to allow independent evolution of each limit.\n */\nexport const POLICY_BLOCK = {\n /** Maximum length of the policy.uri HTTPS hint (chars). */\n uriMaxLength: 2048,\n /** Maximum length of the policy.version label (chars). */\n versionMaxLength: 256,\n} as const;\n\n/**\n * Maximum tolerated skew between occurred_at and iat for evidence receipts (seconds).\n * If occurred_at > iat within this tolerance, a 'occurred_at_skew' warning is emitted.\n * If occurred_at > now + tolerance, E_OCCURRED_AT_FUTURE is a hard error.\n */\nexport const OCCURRED_AT_TOLERANCE_SECONDS = 300;\n\n/**\n * Verification strictness profiles for Wire 0.2.\n * Owned exclusively by @peac/protocol.verifyLocal(); @peac/crypto has no strictness parameter.\n *\n * - 'strict' (default): typ MUST be present and correct; missing typ is a hard error.\n * - 'interop': tolerates missing typ; emits 'typ_missing' warning; routes by peac_version.\n */\nexport type VerificationStrictness = 'strict' | 'interop';\n\n/**\n * JOSE signature algorithm (EdDSA / Ed25519). Re-exported from kernel for layer\n * correctness: @peac/crypto imports all typ/alg constants from @peac/kernel only.\n */\nexport const PEAC_ALG = ALGORITHMS.default;\n\n// ---------------------------------------------------------------------------\n// Legacy aggregate export (unchanged)\n// ---------------------------------------------------------------------------\n\n/**\n * All constants export\n */\nexport const CONSTANTS = {\n WIRE_TYPE,\n WIRE_VERSION,\n ALGORITHMS,\n HEADERS,\n DISCOVERY,\n JWKS,\n RECEIPT,\n LIMITS,\n BUNDLE_VERSION,\n VERIFICATION_REPORT_VERSION,\n HASH,\n VERIFIER_LIMITS,\n VERIFIER_NETWORK,\n VERIFIER_POLICY_VERSION,\n VERIFICATION_MODES,\n} as const;\n"]}
1
+ {"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";;;AAWO,IAAM,SAAA,GAAY;AASlB,IAAM,YAAA,GAAe;AAKrB,IAAM,UAAA,GAAa;AAAA,EACxB,SAAA,EAAW,CAAC,OAAO,CAAA;AAAA,EACnB,OAAA,EAAS;AACX;AAKO,IAAM,OAAA,GAAU;AAAA,EACrB,OAAA,EAAS,cAAA;AAAA,EACT,cAAA,EAAgB,sBAAA;AAAA,EAChB,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,OAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF","file":"constants.cjs","sourcesContent":["/**\n * PEAC Protocol Constants\n */\n\n/**\n * Wire 0.1 JWS `typ` claim (legacy constant name).\n *\n * @deprecated Use `WIRE_01_JWS_TYP` for new code. `WIRE_TYPE` and\n * `WIRE_01_JWS_TYP` resolve to the same string; `WIRE_01_JWS_TYP` is the\n * canonical name at the JWS layer (v0.12.0-preview.1+, Wire 0.2 dual-stack).\n */\nexport const WIRE_TYPE = 'peac-receipt/0.1' as const;\n\n/**\n * Wire 0.1 version string (legacy constant name).\n *\n * @deprecated Use `WIRE_VERSIONS` or compare against `WIRE_02_VERSION` for\n * dual-stack version detection. `WIRE_VERSION` remains valid for Wire 0.1\n * but does not participate in the Wire 0.2 version model.\n */\nexport const WIRE_VERSION = '0.1' as const;\n\n/**\n * Supported cryptographic algorithms\n */\nexport const ALGORITHMS = {\n supported: ['EdDSA'] as const,\n default: 'EdDSA' as const,\n} as const;\n\n/**\n * HTTP header names for PEAC protocol\n */\nexport const HEADERS = {\n receipt: 'PEAC-Receipt' as const,\n receiptPointer: 'PEAC-Receipt-Pointer' as const,\n dpop: 'DPoP' as const,\n // Purpose headers (v0.9.24+)\n purpose: 'PEAC-Purpose' as const,\n purposeApplied: 'PEAC-Purpose-Applied' as const,\n purposeReason: 'PEAC-Purpose-Reason' as const,\n} as const;\n\n/**\n * Policy manifest settings (/.well-known/peac.txt)\n *\n * Policy documents declare access terms for agents and gateways.\n * @see docs/specs/PEAC-TXT.md\n */\nexport const POLICY = {\n manifestPath: '/.well-known/peac.txt' as const,\n fallbackPath: '/peac.txt' as const,\n manifestVersion: 'peac-policy/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 262144, // 256 KiB\n maxDepth: 8,\n} as const;\n\n/**\n * Issuer configuration settings (/.well-known/peac-issuer.json)\n *\n * Issuer config enables verifiers to discover JWKS and verification endpoints.\n * @see docs/specs/PEAC-ISSUER.md\n */\nexport const ISSUER_CONFIG = {\n configPath: '/.well-known/peac-issuer.json' as const,\n configVersion: 'peac-issuer/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 65536, // 64 KiB\n maxDepth: 4,\n fetchTimeoutMs: 10000,\n} as const;\n\n/**\n * @deprecated Use POLICY instead. Will be removed in v1.0.\n */\nexport const DISCOVERY = {\n manifestPath: POLICY.manifestPath,\n manifestVersion: 'peac/0.9' as const,\n cacheTtlSeconds: POLICY.cacheTtlSeconds,\n} as const;\n\n/**\n * JWKS rotation and revocation settings\n */\nexport const JWKS = {\n rotationDays: 90,\n /** Normative minimum overlap period (v0.11.3+) */\n overlapDays: 30,\n emergencyRevocationHours: 24,\n} as const;\n\n/**\n * Receipt validation constants\n */\nexport const RECEIPT = {\n minReceiptIdLength: 16,\n maxReceiptIdLength: 64,\n defaultTtlSeconds: 86400, // 24 hours\n} as const;\n\n/**\n * Payment amount validation limits (in cents/smallest currency unit)\n */\nexport const LIMITS = {\n maxAmountCents: 999999999999,\n minAmountCents: 1,\n} as const;\n\n/**\n * Bundle format version.\n * Used in dispute bundles, audit bundles, and archive bundles.\n */\nexport const BUNDLE_VERSION = 'peac-bundle/0.1' as const;\n\n/**\n * Verification report format version.\n */\nexport const VERIFICATION_REPORT_VERSION = 'peac-verification-report/0.1' as const;\n\n/**\n * Hash format constants and utilities.\n * All hashes use the self-describing format: sha256:<64 lowercase hex chars>\n */\nexport const HASH = {\n /** Canonical hash algorithm */\n algorithm: 'sha256' as const,\n\n /** Hash prefix pattern */\n prefix: 'sha256:' as const,\n\n /** Valid hash regex: sha256:<64 lowercase hex> */\n pattern: /^sha256:[0-9a-f]{64}$/,\n\n /** Hex-only pattern for legacy comparison */\n hexPattern: /^[0-9a-f]{64}$/,\n};\n\n/**\n * Parse a sha256:<hex> hash string into components.\n * Returns null if the format is invalid.\n *\n * @param hash - Hash string to parse (e.g., \"sha256:abc123...\")\n * @returns Parsed hash or null if invalid\n */\nexport function parseHash(hash: string): { alg: 'sha256'; hex: string } | null {\n if (!HASH.pattern.test(hash)) {\n return null;\n }\n return {\n alg: 'sha256',\n hex: hash.slice(7), // Remove 'sha256:' prefix\n };\n}\n\n/**\n * Format a hex string as a sha256:<hex> hash.\n * Validates that the hex is exactly 64 lowercase characters.\n *\n * @param hex - Hex string (64 lowercase characters)\n * @returns Formatted hash or null if invalid\n */\nexport function formatHash(hex: string): string | null {\n if (!HASH.hexPattern.test(hex)) {\n return null;\n }\n return `sha256:${hex}`;\n}\n\n/**\n * Validate a hash string is in the correct format.\n *\n * @param hash - Hash string to validate\n * @returns true if valid sha256:<64 hex> format\n */\nexport function isValidHash(hash: string): boolean {\n return HASH.pattern.test(hash);\n}\n\n/**\n * Verifier security limits per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_LIMITS = {\n /** Maximum receipt size in bytes (256 KB) */\n maxReceiptBytes: 262144,\n /** Maximum number of claims in a receipt */\n maxClaimsCount: 100,\n /** Maximum extension size in bytes (64 KB) */\n maxExtensionBytes: 65536,\n /** Maximum string length for individual claims (64 KB) */\n maxStringLength: 65536,\n /** Maximum JWKS document size in bytes (64 KB) */\n maxJwksBytes: 65536,\n /** Maximum number of keys in a JWKS */\n maxJwksKeys: 20,\n /** Maximum individual key size in bytes */\n maxKeySize: 4096,\n /** Network fetch timeout in milliseconds */\n fetchTimeoutMs: 5000,\n /** Maximum number of redirects to follow */\n maxRedirects: 3,\n /** Maximum network response size in bytes (256 KB) */\n maxResponseBytes: 262144,\n} as const;\n\n/**\n * Verifier network security settings per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_NETWORK = {\n /** Only allow HTTPS URLs */\n httpsOnly: true,\n /** Block requests to private IP ranges */\n blockPrivateIps: true,\n /** Default redirect policy (false = no redirects) */\n allowRedirects: false,\n} as const;\n\n/**\n * Private IPv4 CIDR blocks to block for SSRF protection\n */\nexport const PRIVATE_IP_RANGES = {\n /** RFC 1918 private ranges */\n rfc1918: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'] as const,\n /** Link-local addresses */\n linkLocal: ['169.254.0.0/16'] as const,\n /** Loopback addresses */\n loopback: ['127.0.0.0/8'] as const,\n /** IPv6 loopback */\n ipv6Loopback: ['::1/128'] as const,\n /** IPv6 link-local */\n ipv6LinkLocal: ['fe80::/10'] as const,\n} as const;\n\n/**\n * Verifier policy version\n */\nexport const VERIFIER_POLICY_VERSION = 'peac-verifier-policy/0.1' as const;\n\n/**\n * Verification modes per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFICATION_MODES = {\n /** All verification in browser/client, may fetch JWKS */\n clientSide: 'client_side' as const,\n /** No network access, uses bundled/pinned keys */\n offlineOnly: 'offline_only' as const,\n /** Prefer offline, fallback to network */\n offlinePreferred: 'offline_preferred' as const,\n /** Allow network fetches for key discovery */\n networkAllowed: 'network_allowed' as const,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Wire 0.2 constants (v0.12.0-preview.1)\n// ---------------------------------------------------------------------------\n\n/**\n * JWS header typ value for Wire 0.1 receipts.\n * Canonical location: @peac/kernel (layer correction from @peac/schema).\n * The existing WIRE_TYPE constant is unchanged; both resolve to the same string.\n * @peac/schema re-exports this as PEAC_WIRE_TYP for backward compatibility.\n */\nexport const WIRE_01_JWS_TYP = 'peac-receipt/0.1' as const;\n\n/**\n * JWS header typ value for Wire 0.2 receipts (compact form).\n * Per RFC 7515 Section 4.1.9, the full media type form\n * 'application/interaction-record+jwt' is also accepted by verifiers and\n * normalized to this compact form before returning the header.\n */\nexport const WIRE_02_JWS_TYP = 'interaction-record+jwt' as const;\n\n/**\n * All accepted typ values for Wire 0.2 (compact + full media type form).\n * Used internally by @peac/crypto to fast-reject unrelated tokens.\n * Verifiers normalize the full form to WIRE_02_JWS_TYP before returning.\n */\nexport const WIRE_02_JWS_TYP_ACCEPT = [\n 'interaction-record+jwt',\n 'application/interaction-record+jwt',\n] as const;\n\n/**\n * Wire 0.2 peac_version payload claim value.\n * Discriminates Wire 0.2 envelopes from Wire 0.1 (which have no peac_version field).\n */\nexport const WIRE_02_VERSION = '0.2' as const;\n\n/**\n * All supported wire version strings for dual-stack implementations.\n */\nexport const WIRE_VERSIONS = ['0.1', '0.2'] as const;\n\n/**\n * TypeScript union type for supported wire version values.\n */\nexport type WireVersion = (typeof WIRE_VERSIONS)[number];\n\n/**\n * Canonical issuer (iss) constraints for Wire 0.2.\n * Supported schemes: 'https' (RFC 3986 origin-only) and 'did' (DID Core).\n * All other schemes produce E_ISS_NOT_CANONICAL.\n */\nexport const ISS_CANONICAL = {\n maxLength: 2048,\n supportedSchemes: ['https', 'did'] as const,\n /** Default port for https (rejected if explicit in iss). */\n defaultPorts: { https: 443 } as Record<string, number>,\n} as const;\n\n/**\n * type claim grammar constraints (open vocabulary: reverse-DNS or absolute URI).\n */\nexport const TYPE_GRAMMAR = { maxLength: 256 } as const;\n\n/**\n * policy block field constraints (Wire 0.2).\n * Separate from ISS_CANONICAL to allow independent evolution of each limit.\n */\nexport const POLICY_BLOCK = {\n /** Maximum length of the policy.uri HTTPS hint (chars). */\n uriMaxLength: 2048,\n /** Maximum length of the policy.version label (chars). */\n versionMaxLength: 256,\n} as const;\n\n/**\n * Maximum tolerated skew between occurred_at and iat for evidence receipts (seconds).\n * If occurred_at > iat within this tolerance, a 'occurred_at_skew' warning is emitted.\n * If occurred_at > now + tolerance, E_OCCURRED_AT_FUTURE is a hard error.\n */\nexport const OCCURRED_AT_TOLERANCE_SECONDS = 300;\n\n/**\n * Verification strictness profiles for Wire 0.2.\n * Owned exclusively by @peac/protocol.verifyLocal(); @peac/crypto has no strictness parameter.\n *\n * - 'strict' (default): typ MUST be present and correct; missing typ is a hard error.\n * - 'interop': tolerates missing typ; emits 'typ_missing' warning; routes by peac_version.\n */\nexport type VerificationStrictness = 'strict' | 'interop';\n\n/**\n * JOSE signature algorithm (EdDSA / Ed25519). Re-exported from kernel for layer\n * correctness: @peac/crypto imports all typ/alg constants from @peac/kernel only.\n */\nexport const PEAC_ALG = ALGORITHMS.default;\n\n// ---------------------------------------------------------------------------\n// Extension byte-budget constants (v0.12.2)\n// ---------------------------------------------------------------------------\n\n/**\n * Normative resource-budget limits for Wire 0.2 extension groups.\n *\n * These limits prevent DoS via formally valid but enormous multi-extension\n * receipts. Enforcement is unconditional in @peac/schema's\n * validateKnownExtensions() superRefine callback.\n *\n * MEASUREMENT BASIS (normative): Byte budgets are measured as the UTF-8\n * byte length of the ECMAScript `JSON.stringify()` output on the plain\n * JSON data value. This means:\n * - Object key ordering affects byte count (implementation-defined).\n * - Objects with `toJSON()` methods produce their toJSON output.\n * - Circular references cause serialization failure (treated as over-budget).\n * - `undefined` values are omitted (not counted).\n * - Multi-byte UTF-8 characters (emoji, CJK, etc.) count their full\n * UTF-8 encoding, not JS string length.\n *\n * This is explicitly NOT canonical JSON (JCS/RFC 8785) or raw wire octets.\n * The choice of JSON.stringify is pragmatic: it matches the serialization\n * path used by all major JSON-based transports (MCP, A2A, HTTP). If\n * interop requires canonical measurement, a future DD can narrow this\n * to JCS; the current rule is a safe superset.\n */\nexport const EXTENSION_BUDGET = {\n /** Max UTF-8 bytes per extension group after JSON.stringify (64 KB) */\n maxGroupBytes: 65_536,\n\n /** Max total UTF-8 bytes across all extensions after JSON.stringify (256 KB) */\n maxTotalBytes: 262_144,\n\n /** Max UTF-8 bytes for any single string array field (32 KB) */\n maxArrayPayloadBytes: 32_768,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Legacy aggregate export (unchanged)\n// ---------------------------------------------------------------------------\n\n/**\n * All constants export\n */\nexport const CONSTANTS = {\n WIRE_TYPE,\n WIRE_VERSION,\n ALGORITHMS,\n HEADERS,\n DISCOVERY,\n JWKS,\n RECEIPT,\n LIMITS,\n BUNDLE_VERSION,\n VERIFICATION_REPORT_VERSION,\n HASH,\n VERIFIER_LIMITS,\n VERIFIER_NETWORK,\n VERIFIER_POLICY_VERSION,\n VERIFICATION_MODES,\n} as const;\n"]}
@@ -76,7 +76,7 @@ export declare const DISCOVERY: {
76
76
  */
77
77
  export declare const JWKS: {
78
78
  readonly rotationDays: 90;
79
- /** Normative minimum overlap period (DD-148, v0.11.3+) */
79
+ /** Normative minimum overlap period (v0.11.3+) */
80
80
  readonly overlapDays: 30;
81
81
  readonly emergencyRevocationHours: 24;
82
82
  };
@@ -263,7 +263,7 @@ export declare const TYPE_GRAMMAR: {
263
263
  readonly maxLength: 256;
264
264
  };
265
265
  /**
266
- * policy block field constraints (Wire 0.2, DD-151).
266
+ * policy block field constraints (Wire 0.2).
267
267
  * Separate from ISS_CANONICAL to allow independent evolution of each limit.
268
268
  */
269
269
  export declare const POLICY_BLOCK: {
@@ -291,6 +291,37 @@ export type VerificationStrictness = 'strict' | 'interop';
291
291
  * correctness: @peac/crypto imports all typ/alg constants from @peac/kernel only.
292
292
  */
293
293
  export declare const PEAC_ALG: "EdDSA";
294
+ /**
295
+ * Normative resource-budget limits for Wire 0.2 extension groups.
296
+ *
297
+ * These limits prevent DoS via formally valid but enormous multi-extension
298
+ * receipts. Enforcement is unconditional in @peac/schema's
299
+ * validateKnownExtensions() superRefine callback.
300
+ *
301
+ * MEASUREMENT BASIS (normative): Byte budgets are measured as the UTF-8
302
+ * byte length of the ECMAScript `JSON.stringify()` output on the plain
303
+ * JSON data value. This means:
304
+ * - Object key ordering affects byte count (implementation-defined).
305
+ * - Objects with `toJSON()` methods produce their toJSON output.
306
+ * - Circular references cause serialization failure (treated as over-budget).
307
+ * - `undefined` values are omitted (not counted).
308
+ * - Multi-byte UTF-8 characters (emoji, CJK, etc.) count their full
309
+ * UTF-8 encoding, not JS string length.
310
+ *
311
+ * This is explicitly NOT canonical JSON (JCS/RFC 8785) or raw wire octets.
312
+ * The choice of JSON.stringify is pragmatic: it matches the serialization
313
+ * path used by all major JSON-based transports (MCP, A2A, HTTP). If
314
+ * interop requires canonical measurement, a future DD can narrow this
315
+ * to JCS; the current rule is a safe superset.
316
+ */
317
+ export declare const EXTENSION_BUDGET: {
318
+ /** Max UTF-8 bytes per extension group after JSON.stringify (64 KB) */
319
+ readonly maxGroupBytes: 65536;
320
+ /** Max total UTF-8 bytes across all extensions after JSON.stringify (256 KB) */
321
+ readonly maxTotalBytes: 262144;
322
+ /** Max UTF-8 bytes for any single string array field (32 KB) */
323
+ readonly maxArrayPayloadBytes: 32768;
324
+ };
294
325
  /**
295
326
  * All constants export
296
327
  */
@@ -316,7 +347,7 @@ export declare const CONSTANTS: {
316
347
  };
317
348
  readonly JWKS: {
318
349
  readonly rotationDays: 90;
319
- /** Normative minimum overlap period (DD-148, v0.11.3+) */
350
+ /** Normative minimum overlap period (v0.11.3+) */
320
351
  readonly overlapDays: 30;
321
352
  readonly emergencyRevocationHours: 24;
322
353
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAG,kBAA2B,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;CAQV,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,IAAI;;IAEf,0DAA0D;;;CAGlD,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;CAIV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAG,iBAA0B,CAAC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AAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,QAAQ,SAAqB,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gBAAgB;IAC3B,uEAAuE;;IAGvE,gFAAgF;;IAGhF,gEAAgE;;CAExD,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;QAlTpB,kDAAkD;;;;;;;;;;;;;;;;QAsClD,+BAA+B;;QAG/B,0BAA0B;;QAG1B,kDAAkD;;QAGlD,6CAA6C;;;;QAiD7C,6CAA6C;;QAE7C,4CAA4C;;QAE5C,8CAA8C;;QAE9C,0DAA0D;;QAE1D,kDAAkD;;QAElD,uCAAuC;;QAEvC,2CAA2C;;QAE3C,4CAA4C;;QAE5C,4CAA4C;;QAE5C,sDAAsD;;;;QAQtD,4BAA4B;;QAE5B,0CAA0C;;QAE1C,qDAAqD;;;;;QA6BrD,yDAAyD;;QAEzD,kDAAkD;;QAElD,0CAA0C;;QAE1C,8CAA8C;;;CAiKtC,CAAC"}
@@ -39,7 +39,7 @@ var DISCOVERY = {
39
39
  };
40
40
  var JWKS = {
41
41
  rotationDays: 90,
42
- /** Normative minimum overlap period (DD-148, v0.11.3+) */
42
+ /** Normative minimum overlap period (v0.11.3+) */
43
43
  overlapDays: 30,
44
44
  emergencyRevocationHours: 24
45
45
  };
@@ -160,6 +160,14 @@ var POLICY_BLOCK = {
160
160
  };
161
161
  var OCCURRED_AT_TOLERANCE_SECONDS = 300;
162
162
  var PEAC_ALG = ALGORITHMS.default;
163
+ var EXTENSION_BUDGET = {
164
+ /** Max UTF-8 bytes per extension group after JSON.stringify (64 KB) */
165
+ maxGroupBytes: 65536,
166
+ /** Max total UTF-8 bytes across all extensions after JSON.stringify (256 KB) */
167
+ maxTotalBytes: 262144,
168
+ /** Max UTF-8 bytes for any single string array field (32 KB) */
169
+ maxArrayPayloadBytes: 32768
170
+ };
163
171
  var CONSTANTS = {
164
172
  WIRE_TYPE,
165
173
  WIRE_VERSION,
@@ -178,6 +186,6 @@ var CONSTANTS = {
178
186
  VERIFICATION_MODES
179
187
  };
180
188
 
181
- export { ALGORITHMS, BUNDLE_VERSION, CONSTANTS, DISCOVERY, HASH, HEADERS, ISSUER_CONFIG, ISS_CANONICAL, JWKS, LIMITS, OCCURRED_AT_TOLERANCE_SECONDS, PEAC_ALG, POLICY, POLICY_BLOCK, PRIVATE_IP_RANGES, RECEIPT, TYPE_GRAMMAR, VERIFICATION_MODES, VERIFICATION_REPORT_VERSION, VERIFIER_LIMITS, VERIFIER_NETWORK, VERIFIER_POLICY_VERSION, WIRE_01_JWS_TYP, WIRE_02_JWS_TYP, WIRE_02_JWS_TYP_ACCEPT, WIRE_02_VERSION, WIRE_TYPE, WIRE_VERSION, WIRE_VERSIONS, formatHash, isValidHash, parseHash };
189
+ export { ALGORITHMS, BUNDLE_VERSION, CONSTANTS, DISCOVERY, EXTENSION_BUDGET, HASH, HEADERS, ISSUER_CONFIG, ISS_CANONICAL, JWKS, LIMITS, OCCURRED_AT_TOLERANCE_SECONDS, PEAC_ALG, POLICY, POLICY_BLOCK, PRIVATE_IP_RANGES, RECEIPT, TYPE_GRAMMAR, VERIFICATION_MODES, VERIFICATION_REPORT_VERSION, VERIFIER_LIMITS, VERIFIER_NETWORK, VERIFIER_POLICY_VERSION, WIRE_01_JWS_TYP, WIRE_02_JWS_TYP, WIRE_02_JWS_TYP_ACCEPT, WIRE_02_VERSION, WIRE_TYPE, WIRE_VERSION, WIRE_VERSIONS, formatHash, isValidHash, parseHash };
182
190
  //# sourceMappingURL=constants.mjs.map
183
191
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";AAWO,IAAM,SAAA,GAAY;AASlB,IAAM,YAAA,GAAe;AAKrB,IAAM,UAAA,GA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,SAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF","file":"constants.mjs","sourcesContent":["/**\n * PEAC Protocol Constants\n */\n\n/**\n * Wire 0.1 JWS `typ` claim (legacy constant name).\n *\n * @deprecated Use `WIRE_01_JWS_TYP` for new code. `WIRE_TYPE` and\n * `WIRE_01_JWS_TYP` resolve to the same string; `WIRE_01_JWS_TYP` is the\n * canonical name at the JWS layer (v0.12.0-preview.1+, Wire 0.2 dual-stack).\n */\nexport const WIRE_TYPE = 'peac-receipt/0.1' as const;\n\n/**\n * Wire 0.1 version string (legacy constant name).\n *\n * @deprecated Use `WIRE_VERSIONS` or compare against `WIRE_02_VERSION` for\n * dual-stack version detection. `WIRE_VERSION` remains valid for Wire 0.1\n * but does not participate in the Wire 0.2 version model.\n */\nexport const WIRE_VERSION = '0.1' as const;\n\n/**\n * Supported cryptographic algorithms\n */\nexport const ALGORITHMS = {\n supported: ['EdDSA'] as const,\n default: 'EdDSA' as const,\n} as const;\n\n/**\n * HTTP header names for PEAC protocol\n */\nexport const HEADERS = {\n receipt: 'PEAC-Receipt' as const,\n receiptPointer: 'PEAC-Receipt-Pointer' as const,\n dpop: 'DPoP' as const,\n // Purpose headers (v0.9.24+)\n purpose: 'PEAC-Purpose' as const,\n purposeApplied: 'PEAC-Purpose-Applied' as const,\n purposeReason: 'PEAC-Purpose-Reason' as const,\n} as const;\n\n/**\n * Policy manifest settings (/.well-known/peac.txt)\n *\n * Policy documents declare access terms for agents and gateways.\n * @see docs/specs/PEAC-TXT.md\n */\nexport const POLICY = {\n manifestPath: '/.well-known/peac.txt' as const,\n fallbackPath: '/peac.txt' as const,\n manifestVersion: 'peac-policy/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 262144, // 256 KiB\n maxDepth: 8,\n} as const;\n\n/**\n * Issuer configuration settings (/.well-known/peac-issuer.json)\n *\n * Issuer config enables verifiers to discover JWKS and verification endpoints.\n * @see docs/specs/PEAC-ISSUER.md\n */\nexport const ISSUER_CONFIG = {\n configPath: '/.well-known/peac-issuer.json' as const,\n configVersion: 'peac-issuer/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 65536, // 64 KiB\n maxDepth: 4,\n fetchTimeoutMs: 10000,\n} as const;\n\n/**\n * @deprecated Use POLICY instead. Will be removed in v1.0.\n */\nexport const DISCOVERY = {\n manifestPath: POLICY.manifestPath,\n manifestVersion: 'peac/0.9' as const,\n cacheTtlSeconds: POLICY.cacheTtlSeconds,\n} as const;\n\n/**\n * JWKS rotation and revocation settings\n */\nexport const JWKS = {\n rotationDays: 90,\n /** Normative minimum overlap period (DD-148, v0.11.3+) */\n overlapDays: 30,\n emergencyRevocationHours: 24,\n} as const;\n\n/**\n * Receipt validation constants\n */\nexport const RECEIPT = {\n minReceiptIdLength: 16,\n maxReceiptIdLength: 64,\n defaultTtlSeconds: 86400, // 24 hours\n} as const;\n\n/**\n * Payment amount validation limits (in cents/smallest currency unit)\n */\nexport const LIMITS = {\n maxAmountCents: 999999999999,\n minAmountCents: 1,\n} as const;\n\n/**\n * Bundle format version.\n * Used in dispute bundles, audit bundles, and archive bundles.\n */\nexport const BUNDLE_VERSION = 'peac-bundle/0.1' as const;\n\n/**\n * Verification report format version.\n */\nexport const VERIFICATION_REPORT_VERSION = 'peac-verification-report/0.1' as const;\n\n/**\n * Hash format constants and utilities.\n * All hashes use the self-describing format: sha256:<64 lowercase hex chars>\n */\nexport const HASH = {\n /** Canonical hash algorithm */\n algorithm: 'sha256' as const,\n\n /** Hash prefix pattern */\n prefix: 'sha256:' as const,\n\n /** Valid hash regex: sha256:<64 lowercase hex> */\n pattern: /^sha256:[0-9a-f]{64}$/,\n\n /** Hex-only pattern for legacy comparison */\n hexPattern: /^[0-9a-f]{64}$/,\n};\n\n/**\n * Parse a sha256:<hex> hash string into components.\n * Returns null if the format is invalid.\n *\n * @param hash - Hash string to parse (e.g., \"sha256:abc123...\")\n * @returns Parsed hash or null if invalid\n */\nexport function parseHash(hash: string): { alg: 'sha256'; hex: string } | null {\n if (!HASH.pattern.test(hash)) {\n return null;\n }\n return {\n alg: 'sha256',\n hex: hash.slice(7), // Remove 'sha256:' prefix\n };\n}\n\n/**\n * Format a hex string as a sha256:<hex> hash.\n * Validates that the hex is exactly 64 lowercase characters.\n *\n * @param hex - Hex string (64 lowercase characters)\n * @returns Formatted hash or null if invalid\n */\nexport function formatHash(hex: string): string | null {\n if (!HASH.hexPattern.test(hex)) {\n return null;\n }\n return `sha256:${hex}`;\n}\n\n/**\n * Validate a hash string is in the correct format.\n *\n * @param hash - Hash string to validate\n * @returns true if valid sha256:<64 hex> format\n */\nexport function isValidHash(hash: string): boolean {\n return HASH.pattern.test(hash);\n}\n\n/**\n * Verifier security limits per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_LIMITS = {\n /** Maximum receipt size in bytes (256 KB) */\n maxReceiptBytes: 262144,\n /** Maximum number of claims in a receipt */\n maxClaimsCount: 100,\n /** Maximum extension size in bytes (64 KB) */\n maxExtensionBytes: 65536,\n /** Maximum string length for individual claims (64 KB) */\n maxStringLength: 65536,\n /** Maximum JWKS document size in bytes (64 KB) */\n maxJwksBytes: 65536,\n /** Maximum number of keys in a JWKS */\n maxJwksKeys: 20,\n /** Maximum individual key size in bytes */\n maxKeySize: 4096,\n /** Network fetch timeout in milliseconds */\n fetchTimeoutMs: 5000,\n /** Maximum number of redirects to follow */\n maxRedirects: 3,\n /** Maximum network response size in bytes (256 KB) */\n maxResponseBytes: 262144,\n} as const;\n\n/**\n * Verifier network security settings per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_NETWORK = {\n /** Only allow HTTPS URLs */\n httpsOnly: true,\n /** Block requests to private IP ranges */\n blockPrivateIps: true,\n /** Default redirect policy (false = no redirects) */\n allowRedirects: false,\n} as const;\n\n/**\n * Private IPv4 CIDR blocks to block for SSRF protection\n */\nexport const PRIVATE_IP_RANGES = {\n /** RFC 1918 private ranges */\n rfc1918: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'] as const,\n /** Link-local addresses */\n linkLocal: ['169.254.0.0/16'] as const,\n /** Loopback addresses */\n loopback: ['127.0.0.0/8'] as const,\n /** IPv6 loopback */\n ipv6Loopback: ['::1/128'] as const,\n /** IPv6 link-local */\n ipv6LinkLocal: ['fe80::/10'] as const,\n} as const;\n\n/**\n * Verifier policy version\n */\nexport const VERIFIER_POLICY_VERSION = 'peac-verifier-policy/0.1' as const;\n\n/**\n * Verification modes per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFICATION_MODES = {\n /** All verification in browser/client, may fetch JWKS */\n clientSide: 'client_side' as const,\n /** No network access, uses bundled/pinned keys */\n offlineOnly: 'offline_only' as const,\n /** Prefer offline, fallback to network */\n offlinePreferred: 'offline_preferred' as const,\n /** Allow network fetches for key discovery */\n networkAllowed: 'network_allowed' as const,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Wire 0.2 constants (v0.12.0-preview.1, DD-156)\n// ---------------------------------------------------------------------------\n\n/**\n * JWS header typ value for Wire 0.1 receipts.\n * Canonical location: @peac/kernel (layer correction from @peac/schema).\n * The existing WIRE_TYPE constant is unchanged; both resolve to the same string.\n * @peac/schema re-exports this as PEAC_WIRE_TYP for backward compatibility.\n */\nexport const WIRE_01_JWS_TYP = 'peac-receipt/0.1' as const;\n\n/**\n * JWS header typ value for Wire 0.2 receipts (compact form).\n * Per RFC 7515 Section 4.1.9, the full media type form\n * 'application/interaction-record+jwt' is also accepted by verifiers and\n * normalized to this compact form before returning the header.\n */\nexport const WIRE_02_JWS_TYP = 'interaction-record+jwt' as const;\n\n/**\n * All accepted typ values for Wire 0.2 (compact + full media type form).\n * Used internally by @peac/crypto to fast-reject unrelated tokens.\n * Verifiers normalize the full form to WIRE_02_JWS_TYP before returning.\n */\nexport const WIRE_02_JWS_TYP_ACCEPT = [\n 'interaction-record+jwt',\n 'application/interaction-record+jwt',\n] as const;\n\n/**\n * Wire 0.2 peac_version payload claim value.\n * Discriminates Wire 0.2 envelopes from Wire 0.1 (which have no peac_version field).\n */\nexport const WIRE_02_VERSION = '0.2' as const;\n\n/**\n * All supported wire version strings for dual-stack implementations.\n */\nexport const WIRE_VERSIONS = ['0.1', '0.2'] as const;\n\n/**\n * TypeScript union type for supported wire version values.\n */\nexport type WireVersion = (typeof WIRE_VERSIONS)[number];\n\n/**\n * Canonical issuer (iss) constraints for Wire 0.2.\n * Supported schemes: 'https' (RFC 3986 origin-only) and 'did' (DID Core).\n * All other schemes produce E_ISS_NOT_CANONICAL.\n */\nexport const ISS_CANONICAL = {\n maxLength: 2048,\n supportedSchemes: ['https', 'did'] as const,\n /** Default port for https (rejected if explicit in iss). */\n defaultPorts: { https: 443 } as Record<string, number>,\n} as const;\n\n/**\n * type claim grammar constraints (open vocabulary: reverse-DNS or absolute URI).\n */\nexport const TYPE_GRAMMAR = { maxLength: 256 } as const;\n\n/**\n * policy block field constraints (Wire 0.2, DD-151).\n * Separate from ISS_CANONICAL to allow independent evolution of each limit.\n */\nexport const POLICY_BLOCK = {\n /** Maximum length of the policy.uri HTTPS hint (chars). */\n uriMaxLength: 2048,\n /** Maximum length of the policy.version label (chars). */\n versionMaxLength: 256,\n} as const;\n\n/**\n * Maximum tolerated skew between occurred_at and iat for evidence receipts (seconds).\n * If occurred_at > iat within this tolerance, a 'occurred_at_skew' warning is emitted.\n * If occurred_at > now + tolerance, E_OCCURRED_AT_FUTURE is a hard error.\n */\nexport const OCCURRED_AT_TOLERANCE_SECONDS = 300;\n\n/**\n * Verification strictness profiles for Wire 0.2.\n * Owned exclusively by @peac/protocol.verifyLocal(); @peac/crypto has no strictness parameter.\n *\n * - 'strict' (default): typ MUST be present and correct; missing typ is a hard error.\n * - 'interop': tolerates missing typ; emits 'typ_missing' warning; routes by peac_version.\n */\nexport type VerificationStrictness = 'strict' | 'interop';\n\n/**\n * JOSE signature algorithm (EdDSA / Ed25519). Re-exported from kernel for layer\n * correctness: @peac/crypto imports all typ/alg constants from @peac/kernel only.\n */\nexport const PEAC_ALG = ALGORITHMS.default;\n\n// ---------------------------------------------------------------------------\n// Legacy aggregate export (unchanged)\n// ---------------------------------------------------------------------------\n\n/**\n * All constants export\n */\nexport const CONSTANTS = {\n WIRE_TYPE,\n WIRE_VERSION,\n ALGORITHMS,\n HEADERS,\n DISCOVERY,\n JWKS,\n RECEIPT,\n LIMITS,\n BUNDLE_VERSION,\n VERIFICATION_REPORT_VERSION,\n HASH,\n VERIFIER_LIMITS,\n VERIFIER_NETWORK,\n VERIFIER_POLICY_VERSION,\n VERIFICATION_MODES,\n} as const;\n"]}
1
+ {"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";AAWO,IAAM,SAAA,GAAY;AASlB,IAAM,YAAA,GAAe;AAKrB,IAAM,UAAA,GAAa;AAAA,EACxB,SAAA,EAAW,CAAC,OAAO,CAAA;AAAA,EACnB,OAAA,EAAS;AACX;AAKO,IAAM,OAAA,GAAU;AAAA,EACrB,OAAA,EAAS,cAAA;AAAA,EACT,cAAA,EAAgB,sBAAA;AAAA,EAChB,IAAA,EAAM,MAAA;AAAA;AAAA,EAEN,OAAA,EAAS,cAAA;AAAA,EACT,cAAA,EAAgB,sBAAA;AAAA,EAChB,aAAA,EAAe;AACjB;AAQO,IAAM,MAAA,GAAS;AAAA,EACpB,YAAA,EAAc,uBAAA;AAAA,EACd,YAAA,EAAc,WAAA;AAAA,EACd,eAAA,EAAiB,iBAAA;AAAA,EACjB,eAAA,EAAiB,IAAA;AAAA,EACjB,QAAA,EAAU,MAAA;AAAA;AAAA,EACV,QAAA,EAAU;AACZ;AAQO,IAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY,+BAAA;AAAA,EACZ,aAAA,EAAe,iBAAA;AAAA,EACf,eAAA,EAAiB,IAAA;AAAA,EACjB,QAAA,EAAU,KA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ACpC,wBAAA;AAAA,EACA;AACF;AAMO,IAAM,eAAA,GAAkB;AAKxB,IAAM,aAAA,GAAgB,CAAC,KAAA,EAAO,KAAK;AAYnC,IAAM,aAAA,GAAgB;AAAA,EAC3B,SAAA,EAAW,IAAA;AAAA,EACX,gBAAA,EAAkB,CAAC,OAAA,EAAS,KAAK,CAAA;AAAA;AAAA,EAEjC,YAAA,EAAc,EAAE,KAAA,EAAO,GAAA;AACzB;AAKO,IAAM,YAAA,GAAe,EAAE,SAAA,EAAW,GAAA;AAMlC,IAAM,YAAA,GAAe;AAAA;AAAA,EAE1B,YAAA,EAAc,IAAA;AAAA;AAAA,EAEd,gBAAA,EAAkB;AACpB;AAOO,IAAM,6BAAA,GAAgC;AAetC,IAAM,WAAW,UAAA,CAAW;AA6B5B,IAAM,gBAAA,GAAmB;AAAA;AAAA,EAE9B,aAAA,EAAe,KAAA;AAAA;AAAA,EAGf,aAAA,EAAe,MAAA;AAAA;AAAA,EAGf,oBAAA,EAAsB;AACxB;AASO,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA;AAAA,EACA,2BAAA;AAAA,EACA,IAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,uBAAA;AAAA,EACA;AACF","file":"constants.mjs","sourcesContent":["/**\n * PEAC Protocol Constants\n */\n\n/**\n * Wire 0.1 JWS `typ` claim (legacy constant name).\n *\n * @deprecated Use `WIRE_01_JWS_TYP` for new code. `WIRE_TYPE` and\n * `WIRE_01_JWS_TYP` resolve to the same string; `WIRE_01_JWS_TYP` is the\n * canonical name at the JWS layer (v0.12.0-preview.1+, Wire 0.2 dual-stack).\n */\nexport const WIRE_TYPE = 'peac-receipt/0.1' as const;\n\n/**\n * Wire 0.1 version string (legacy constant name).\n *\n * @deprecated Use `WIRE_VERSIONS` or compare against `WIRE_02_VERSION` for\n * dual-stack version detection. `WIRE_VERSION` remains valid for Wire 0.1\n * but does not participate in the Wire 0.2 version model.\n */\nexport const WIRE_VERSION = '0.1' as const;\n\n/**\n * Supported cryptographic algorithms\n */\nexport const ALGORITHMS = {\n supported: ['EdDSA'] as const,\n default: 'EdDSA' as const,\n} as const;\n\n/**\n * HTTP header names for PEAC protocol\n */\nexport const HEADERS = {\n receipt: 'PEAC-Receipt' as const,\n receiptPointer: 'PEAC-Receipt-Pointer' as const,\n dpop: 'DPoP' as const,\n // Purpose headers (v0.9.24+)\n purpose: 'PEAC-Purpose' as const,\n purposeApplied: 'PEAC-Purpose-Applied' as const,\n purposeReason: 'PEAC-Purpose-Reason' as const,\n} as const;\n\n/**\n * Policy manifest settings (/.well-known/peac.txt)\n *\n * Policy documents declare access terms for agents and gateways.\n * @see docs/specs/PEAC-TXT.md\n */\nexport const POLICY = {\n manifestPath: '/.well-known/peac.txt' as const,\n fallbackPath: '/peac.txt' as const,\n manifestVersion: 'peac-policy/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 262144, // 256 KiB\n maxDepth: 8,\n} as const;\n\n/**\n * Issuer configuration settings (/.well-known/peac-issuer.json)\n *\n * Issuer config enables verifiers to discover JWKS and verification endpoints.\n * @see docs/specs/PEAC-ISSUER.md\n */\nexport const ISSUER_CONFIG = {\n configPath: '/.well-known/peac-issuer.json' as const,\n configVersion: 'peac-issuer/0.1' as const,\n cacheTtlSeconds: 3600,\n maxBytes: 65536, // 64 KiB\n maxDepth: 4,\n fetchTimeoutMs: 10000,\n} as const;\n\n/**\n * @deprecated Use POLICY instead. Will be removed in v1.0.\n */\nexport const DISCOVERY = {\n manifestPath: POLICY.manifestPath,\n manifestVersion: 'peac/0.9' as const,\n cacheTtlSeconds: POLICY.cacheTtlSeconds,\n} as const;\n\n/**\n * JWKS rotation and revocation settings\n */\nexport const JWKS = {\n rotationDays: 90,\n /** Normative minimum overlap period (v0.11.3+) */\n overlapDays: 30,\n emergencyRevocationHours: 24,\n} as const;\n\n/**\n * Receipt validation constants\n */\nexport const RECEIPT = {\n minReceiptIdLength: 16,\n maxReceiptIdLength: 64,\n defaultTtlSeconds: 86400, // 24 hours\n} as const;\n\n/**\n * Payment amount validation limits (in cents/smallest currency unit)\n */\nexport const LIMITS = {\n maxAmountCents: 999999999999,\n minAmountCents: 1,\n} as const;\n\n/**\n * Bundle format version.\n * Used in dispute bundles, audit bundles, and archive bundles.\n */\nexport const BUNDLE_VERSION = 'peac-bundle/0.1' as const;\n\n/**\n * Verification report format version.\n */\nexport const VERIFICATION_REPORT_VERSION = 'peac-verification-report/0.1' as const;\n\n/**\n * Hash format constants and utilities.\n * All hashes use the self-describing format: sha256:<64 lowercase hex chars>\n */\nexport const HASH = {\n /** Canonical hash algorithm */\n algorithm: 'sha256' as const,\n\n /** Hash prefix pattern */\n prefix: 'sha256:' as const,\n\n /** Valid hash regex: sha256:<64 lowercase hex> */\n pattern: /^sha256:[0-9a-f]{64}$/,\n\n /** Hex-only pattern for legacy comparison */\n hexPattern: /^[0-9a-f]{64}$/,\n};\n\n/**\n * Parse a sha256:<hex> hash string into components.\n * Returns null if the format is invalid.\n *\n * @param hash - Hash string to parse (e.g., \"sha256:abc123...\")\n * @returns Parsed hash or null if invalid\n */\nexport function parseHash(hash: string): { alg: 'sha256'; hex: string } | null {\n if (!HASH.pattern.test(hash)) {\n return null;\n }\n return {\n alg: 'sha256',\n hex: hash.slice(7), // Remove 'sha256:' prefix\n };\n}\n\n/**\n * Format a hex string as a sha256:<hex> hash.\n * Validates that the hex is exactly 64 lowercase characters.\n *\n * @param hex - Hex string (64 lowercase characters)\n * @returns Formatted hash or null if invalid\n */\nexport function formatHash(hex: string): string | null {\n if (!HASH.hexPattern.test(hex)) {\n return null;\n }\n return `sha256:${hex}`;\n}\n\n/**\n * Validate a hash string is in the correct format.\n *\n * @param hash - Hash string to validate\n * @returns true if valid sha256:<64 hex> format\n */\nexport function isValidHash(hash: string): boolean {\n return HASH.pattern.test(hash);\n}\n\n/**\n * Verifier security limits per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_LIMITS = {\n /** Maximum receipt size in bytes (256 KB) */\n maxReceiptBytes: 262144,\n /** Maximum number of claims in a receipt */\n maxClaimsCount: 100,\n /** Maximum extension size in bytes (64 KB) */\n maxExtensionBytes: 65536,\n /** Maximum string length for individual claims (64 KB) */\n maxStringLength: 65536,\n /** Maximum JWKS document size in bytes (64 KB) */\n maxJwksBytes: 65536,\n /** Maximum number of keys in a JWKS */\n maxJwksKeys: 20,\n /** Maximum individual key size in bytes */\n maxKeySize: 4096,\n /** Network fetch timeout in milliseconds */\n fetchTimeoutMs: 5000,\n /** Maximum number of redirects to follow */\n maxRedirects: 3,\n /** Maximum network response size in bytes (256 KB) */\n maxResponseBytes: 262144,\n} as const;\n\n/**\n * Verifier network security settings per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFIER_NETWORK = {\n /** Only allow HTTPS URLs */\n httpsOnly: true,\n /** Block requests to private IP ranges */\n blockPrivateIps: true,\n /** Default redirect policy (false = no redirects) */\n allowRedirects: false,\n} as const;\n\n/**\n * Private IPv4 CIDR blocks to block for SSRF protection\n */\nexport const PRIVATE_IP_RANGES = {\n /** RFC 1918 private ranges */\n rfc1918: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'] as const,\n /** Link-local addresses */\n linkLocal: ['169.254.0.0/16'] as const,\n /** Loopback addresses */\n loopback: ['127.0.0.0/8'] as const,\n /** IPv6 loopback */\n ipv6Loopback: ['::1/128'] as const,\n /** IPv6 link-local */\n ipv6LinkLocal: ['fe80::/10'] as const,\n} as const;\n\n/**\n * Verifier policy version\n */\nexport const VERIFIER_POLICY_VERSION = 'peac-verifier-policy/0.1' as const;\n\n/**\n * Verification modes per VERIFIER-SECURITY-MODEL.md\n */\nexport const VERIFICATION_MODES = {\n /** All verification in browser/client, may fetch JWKS */\n clientSide: 'client_side' as const,\n /** No network access, uses bundled/pinned keys */\n offlineOnly: 'offline_only' as const,\n /** Prefer offline, fallback to network */\n offlinePreferred: 'offline_preferred' as const,\n /** Allow network fetches for key discovery */\n networkAllowed: 'network_allowed' as const,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Wire 0.2 constants (v0.12.0-preview.1)\n// ---------------------------------------------------------------------------\n\n/**\n * JWS header typ value for Wire 0.1 receipts.\n * Canonical location: @peac/kernel (layer correction from @peac/schema).\n * The existing WIRE_TYPE constant is unchanged; both resolve to the same string.\n * @peac/schema re-exports this as PEAC_WIRE_TYP for backward compatibility.\n */\nexport const WIRE_01_JWS_TYP = 'peac-receipt/0.1' as const;\n\n/**\n * JWS header typ value for Wire 0.2 receipts (compact form).\n * Per RFC 7515 Section 4.1.9, the full media type form\n * 'application/interaction-record+jwt' is also accepted by verifiers and\n * normalized to this compact form before returning the header.\n */\nexport const WIRE_02_JWS_TYP = 'interaction-record+jwt' as const;\n\n/**\n * All accepted typ values for Wire 0.2 (compact + full media type form).\n * Used internally by @peac/crypto to fast-reject unrelated tokens.\n * Verifiers normalize the full form to WIRE_02_JWS_TYP before returning.\n */\nexport const WIRE_02_JWS_TYP_ACCEPT = [\n 'interaction-record+jwt',\n 'application/interaction-record+jwt',\n] as const;\n\n/**\n * Wire 0.2 peac_version payload claim value.\n * Discriminates Wire 0.2 envelopes from Wire 0.1 (which have no peac_version field).\n */\nexport const WIRE_02_VERSION = '0.2' as const;\n\n/**\n * All supported wire version strings for dual-stack implementations.\n */\nexport const WIRE_VERSIONS = ['0.1', '0.2'] as const;\n\n/**\n * TypeScript union type for supported wire version values.\n */\nexport type WireVersion = (typeof WIRE_VERSIONS)[number];\n\n/**\n * Canonical issuer (iss) constraints for Wire 0.2.\n * Supported schemes: 'https' (RFC 3986 origin-only) and 'did' (DID Core).\n * All other schemes produce E_ISS_NOT_CANONICAL.\n */\nexport const ISS_CANONICAL = {\n maxLength: 2048,\n supportedSchemes: ['https', 'did'] as const,\n /** Default port for https (rejected if explicit in iss). */\n defaultPorts: { https: 443 } as Record<string, number>,\n} as const;\n\n/**\n * type claim grammar constraints (open vocabulary: reverse-DNS or absolute URI).\n */\nexport const TYPE_GRAMMAR = { maxLength: 256 } as const;\n\n/**\n * policy block field constraints (Wire 0.2).\n * Separate from ISS_CANONICAL to allow independent evolution of each limit.\n */\nexport const POLICY_BLOCK = {\n /** Maximum length of the policy.uri HTTPS hint (chars). */\n uriMaxLength: 2048,\n /** Maximum length of the policy.version label (chars). */\n versionMaxLength: 256,\n} as const;\n\n/**\n * Maximum tolerated skew between occurred_at and iat for evidence receipts (seconds).\n * If occurred_at > iat within this tolerance, a 'occurred_at_skew' warning is emitted.\n * If occurred_at > now + tolerance, E_OCCURRED_AT_FUTURE is a hard error.\n */\nexport const OCCURRED_AT_TOLERANCE_SECONDS = 300;\n\n/**\n * Verification strictness profiles for Wire 0.2.\n * Owned exclusively by @peac/protocol.verifyLocal(); @peac/crypto has no strictness parameter.\n *\n * - 'strict' (default): typ MUST be present and correct; missing typ is a hard error.\n * - 'interop': tolerates missing typ; emits 'typ_missing' warning; routes by peac_version.\n */\nexport type VerificationStrictness = 'strict' | 'interop';\n\n/**\n * JOSE signature algorithm (EdDSA / Ed25519). Re-exported from kernel for layer\n * correctness: @peac/crypto imports all typ/alg constants from @peac/kernel only.\n */\nexport const PEAC_ALG = ALGORITHMS.default;\n\n// ---------------------------------------------------------------------------\n// Extension byte-budget constants (v0.12.2)\n// ---------------------------------------------------------------------------\n\n/**\n * Normative resource-budget limits for Wire 0.2 extension groups.\n *\n * These limits prevent DoS via formally valid but enormous multi-extension\n * receipts. Enforcement is unconditional in @peac/schema's\n * validateKnownExtensions() superRefine callback.\n *\n * MEASUREMENT BASIS (normative): Byte budgets are measured as the UTF-8\n * byte length of the ECMAScript `JSON.stringify()` output on the plain\n * JSON data value. This means:\n * - Object key ordering affects byte count (implementation-defined).\n * - Objects with `toJSON()` methods produce their toJSON output.\n * - Circular references cause serialization failure (treated as over-budget).\n * - `undefined` values are omitted (not counted).\n * - Multi-byte UTF-8 characters (emoji, CJK, etc.) count their full\n * UTF-8 encoding, not JS string length.\n *\n * This is explicitly NOT canonical JSON (JCS/RFC 8785) or raw wire octets.\n * The choice of JSON.stringify is pragmatic: it matches the serialization\n * path used by all major JSON-based transports (MCP, A2A, HTTP). If\n * interop requires canonical measurement, a future DD can narrow this\n * to JCS; the current rule is a safe superset.\n */\nexport const EXTENSION_BUDGET = {\n /** Max UTF-8 bytes per extension group after JSON.stringify (64 KB) */\n maxGroupBytes: 65_536,\n\n /** Max total UTF-8 bytes across all extensions after JSON.stringify (256 KB) */\n maxTotalBytes: 262_144,\n\n /** Max UTF-8 bytes for any single string array field (32 KB) */\n maxArrayPayloadBytes: 32_768,\n} as const;\n\n// ---------------------------------------------------------------------------\n// Legacy aggregate export (unchanged)\n// ---------------------------------------------------------------------------\n\n/**\n * All constants export\n */\nexport const CONSTANTS = {\n WIRE_TYPE,\n WIRE_VERSION,\n ALGORITHMS,\n HEADERS,\n DISCOVERY,\n JWKS,\n RECEIPT,\n LIMITS,\n BUNDLE_VERSION,\n VERIFICATION_REPORT_VERSION,\n HASH,\n VERIFIER_LIMITS,\n VERIFIER_NETWORK,\n VERIFIER_POLICY_VERSION,\n VERIFICATION_MODES,\n} as const;\n"]}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * AUTO-GENERATED from specs/kernel/errors.json
5
5
  * DO NOT EDIT MANUALLY - run: npx tsx scripts/codegen-errors.ts
6
- * Spec version: 0.12.1
6
+ * Spec version: 0.12.2
7
7
  */
8
8
  /**
9
9
  * Canonical error categories derived from specs/kernel/errors.json.
package/dist/errors.cjs CHANGED
@@ -121,6 +121,8 @@ var ERROR_CODES = {
121
121
  E_EAT_UNSUPPORTED_ALG: "E_EAT_UNSUPPORTED_ALG",
122
122
  E_EVIDENCE_NOT_JSON: "E_EVIDENCE_NOT_JSON",
123
123
  E_EXPIRED: "E_EXPIRED",
124
+ E_EXTENSION_NON_JSON_VALUE: "E_EXTENSION_NON_JSON_VALUE",
125
+ E_EXTENSION_SIZE_EXCEEDED: "E_EXTENSION_SIZE_EXCEEDED",
124
126
  E_INVALID_AMOUNT: "E_INVALID_AMOUNT",
125
127
  E_INVALID_AUDIENCE: "E_INVALID_AUDIENCE",
126
128
  E_INVALID_CURRENCY: "E_INVALID_CURRENCY",
@@ -147,6 +149,8 @@ var ERROR_CODES = {
147
149
  E_WIRE_VERSION_MISMATCH: "E_WIRE_VERSION_MISMATCH",
148
150
  // Verification error codes
149
151
  E_EAT_SIGNATURE_FAILED: "E_EAT_SIGNATURE_FAILED",
152
+ E_EXTENSION_GROUP_MISMATCH: "E_EXTENSION_GROUP_MISMATCH",
153
+ E_EXTENSION_GROUP_REQUIRED: "E_EXTENSION_GROUP_REQUIRED",
150
154
  E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE",
151
155
  E_KEY_NOT_FOUND: "E_KEY_NOT_FOUND",
152
156
  E_KID_REUSE_DETECTED: "E_KID_REUSE_DETECTED",
@@ -1177,6 +1181,24 @@ var ERRORS = {
1177
1181
  next_action: "retry_with_different_input",
1178
1182
  category: "validation"
1179
1183
  },
1184
+ E_EXTENSION_NON_JSON_VALUE: {
1185
+ code: "E_EXTENSION_NON_JSON_VALUE",
1186
+ http_status: 400,
1187
+ title: "Extension Non-JSON Value",
1188
+ description: "Extension group value is not a plain JSON value; functions, Symbols, BigInt, Date, RegExp, Map, Set, objects with toJSON(), and other non-JSON types are rejected",
1189
+ retryable: false,
1190
+ next_action: "retry_with_different_input",
1191
+ category: "validation"
1192
+ },
1193
+ E_EXTENSION_SIZE_EXCEEDED: {
1194
+ code: "E_EXTENSION_SIZE_EXCEEDED",
1195
+ http_status: 400,
1196
+ title: "Extension Size Exceeded",
1197
+ description: "Extension group or total extensions record exceeds the normative byte-budget limit (EXTENSION_BUDGET)",
1198
+ retryable: false,
1199
+ next_action: "retry_with_different_input",
1200
+ category: "validation"
1201
+ },
1180
1202
  E_INVALID_AMOUNT: {
1181
1203
  code: "E_INVALID_AMOUNT",
1182
1204
  http_status: 400,
@@ -1403,6 +1425,24 @@ var ERRORS = {
1403
1425
  next_action: "retry_with_different_key",
1404
1426
  category: "verification"
1405
1427
  },
1428
+ E_EXTENSION_GROUP_MISMATCH: {
1429
+ code: "E_EXTENSION_GROUP_MISMATCH",
1430
+ http_status: 400,
1431
+ title: "Extension Group Mismatch",
1432
+ description: "Registered receipt type has a mapped extension group, but a different registered first-party extension group is present while the expected one is absent",
1433
+ retryable: false,
1434
+ next_action: "retry_with_different_input",
1435
+ category: "verification"
1436
+ },
1437
+ E_EXTENSION_GROUP_REQUIRED: {
1438
+ code: "E_EXTENSION_GROUP_REQUIRED",
1439
+ http_status: 400,
1440
+ title: "Extension Group Required",
1441
+ description: "Registered receipt type has a mapped extension group, but that group is absent from the extensions record",
1442
+ retryable: false,
1443
+ next_action: "retry_with_different_input",
1444
+ category: "verification"
1445
+ },
1406
1446
  E_INVALID_SIGNATURE: {
1407
1447
  code: "E_INVALID_SIGNATURE",
1408
1448
  http_status: 400,