feat: x402 carrier adapter and challenge type mapping #419
Merged
Conversation
Ship PeacEvidenceCarrier types (Layer 0, zero runtime) and Zod schemas with shared computeReceiptRef() helper (Layer 1). Includes carrier conformance fixtures (5 valid, 3 invalid) and verifyReceiptRefConsistency() for DD-129 async extraction enforcement. - kernel: PeacEvidenceCarrier, CarrierAdapter<T,U>, CarrierMeta types - kernel: PEAC_RECEIPT_HEADER canonical constant (DD-127) - schema: ReceiptRefSchema, CompactJwsSchema, PeacEvidenceCarrierSchema - schema: computeReceiptRef() with WebCrypto runtime guard - schema: validateCarrierConstraints() transport-aware validation - schema: verifyReceiptRefConsistency() for tamper detection - schema: CARRIER_TRANSPORT_LIMITS per-transport size constants - conformance: 8 carrier fixtures in specs/conformance/fixtures/carrier/ - conformance: carrier category registered in manifest and tracking
Add Evidence Carrier Contract adapter for @peac/adapter-x402: Carrier adapter (src/carrier.ts): - fromOfferResponse: extract carrier from HTTP 402 PEAC-Receipt header - fromSettlementResponse: extract carrier from HTTP 200 headers - Async variants with computeReceiptRef (DD-129) - X402CarrierAdapter: implements CarrierAdapter<X402ResponseLike> - Case-insensitive header lookup per RFC 9110 Challenge type mapping (src/challenge.ts): - ChallengeType taxonomy for cross-protocol normalization - mapX402ToChallengeType: always returns 'payment' for x402 Mapping update (src/map.ts): - toPeacCarrier: converts receipt JWS to PeacEvidenceCarrier using shared computeReceiptRef from @peac/schema (correction item 4)
… mode - Update module comment to state header-only in v0.11.1 - Use x402_headers (8 KB) limit for all constraint validation since the transport surface is PEAC-Receipt header - Throw on attach when receipt_jws absent (no silent reference drop) - Remove embed/reference branching from defaultX402Meta - Add reference mode rejection test, update constraint test limits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@peac/adapter-x402PEAC-ReceiptHTTP header (offer/settlement responses)toPeacCarrier()using sharedcomputeReceiptRef()from@peac/schema(correction item 4)ChallengeTypetaxonomy for cross-protocol normalization (paymentfor x402)Changes
New files
src/carrier.ts:fromOfferResponse,fromSettlementResponse, async variants,X402CarrierAdaptersrc/challenge.ts:ChallengeType,mapX402ToChallengeTypetests/carrier.test.ts: 22 testsModified files
src/map.ts: addedtoPeacCarrier()functionsrc/index.ts: re-exports carrier + challenge modulesDesign decisions
computeReceiptRef()(not local SHA-256)Test plan
Stacked on