docs(ap2): add Trust Query -- multi-issuer composite verdict envelope (AlgoVoi-authored)#272
Conversation
… (AlgoVoi-authored)
There was a problem hiding this comment.
Code Review
This pull request introduces a new documentation file, docs/ap2/trust_query.md, which defines the Trust Query format—a categorical, content-addressed composite verdict envelope. Feedback on this specification highlights two main issues: first, a potential circular dependency in JCS canonicalisation due to the signature field being included inside the JSON object (making it enveloped rather than detached); second, a logical inconsistency between the mandatory requirement (MUST) to re-derive canonical hashes of referenced attestations and the optional permission (MAY) to walk the reference chain to verify them.
| "issuer_id": "did:web:api.algovoi.co.uk" | ||
| } | ||
| ], | ||
| "signature": "<detached signature over JCS canonical bytes>", |
There was a problem hiding this comment.
Including the signature field inside the JSON object makes it an enveloped signature rather than a detached signature.\n\nTo avoid a circular dependency during JCS canonicalisation and signature verification, the specification should explicitly clarify that the signature field is excluded from the JSON object prior to canonicalisation. Alternatively, if the signature is truly detached, it should be transmitted alongside the JSON payload rather than as a property within it.
| - The `issuer_references` array MUST be evaluated before accepting the | ||
| composite verdict; a verifier MUST re-derive the canonical hash of each | ||
| referenced attestation before trusting the composite. |
There was a problem hiding this comment.
There is a logical inconsistency between the RFC 2119 keywords used here and in the Composition section:\n- Here (lines 141-143), it states: "a verifier MUST re-derive the canonical hash of each referenced attestation before trusting the composite."\n- In the Composition section (lines 109-110), it states: "A relying party MAY walk the reference chain to verify each upstream attestation independently."\n\nIf re-deriving the canonical hash of each referenced attestation is a MUST for trusting the composite, then obtaining and verifying those upstream attestations cannot be a MAY. Consider aligning these requirements so that either both are mandatory for full verification, or the conditional nature of the validation is clearly specified.
…l vs verification Two precision fixes in response to review feedback: 1. Signature preimage: adds explicit 'Signature preimage' subsection under Canonicalisation stating that the signature field is excluded from the JCS preimage. Signs canonical bytes of the remaining fields, then stores the result in the signature field. Eliminates any appearance of circularity between the canonical form and its signature. 2. MUST/MAY consistency: the Composition section 'MAY walk the reference chain' and the Security section 'MUST re-derive the canonical hash' referred to two different operations without making the distinction explicit. Clarified throughout: retrieval of upstream attestations is optional (MAY); if an attestation is retrieved, hash verification is mandatory (MUST). Both sections now use the same framing.
Summary
Adds
docs/ap2/trust_query.md-- the AlgoVoi-authored Composite Trust Query format, a multi-issuer composite verdict envelope that composes independent issuer attestations into a single categorical trust decision.TRUSTED/PROVISIONAL/INSUFFICIENT_EVIDENCE/UNTRUSTEDissuer_referencesarray carries content-addressed references to each upstream attestation consideredurn:x402:canonicalisation:jcs-rfc8785-v1(RFC 8785 JCS), byte-for-byte cross-validated across 8 independent implementationsNormative wire format: IETF Internet-Draft draft-hopley-x402-composite-trust-query (https://datatracker.ietf.org/doc/draft-hopley-x402-composite-trust-query/)
Reference implementations (Apache 2.0): algovoi-composite-trust-query on PyPI, @algovoi/composite-trust-query on npm.
Sibling to PR #269 (Compliance Receipt), PR #270 (Payment Lifecycle), and PR #271 (Settlement Attestation). AP2 references the format; AP2 does not redefine it. AlgoVoi is sole author.
AlgoVoi (chopmob-cloud) -- Acquisition enquiries: https://docs.algovoi.co.uk/acquisition