Skip to content

docs(ap2): add Trust Query -- multi-issuer composite verdict envelope (AlgoVoi-authored)#272

Open
chopmob-cloud wants to merge 5 commits into
google-agentic-commerce:mainfrom
chopmob-cloud:docs-ap2-trust-query
Open

docs(ap2): add Trust Query -- multi-issuer composite verdict envelope (AlgoVoi-authored)#272
chopmob-cloud wants to merge 5 commits into
google-agentic-commerce:mainfrom
chopmob-cloud:docs-ap2-trust-query

Conversation

@chopmob-cloud
Copy link
Copy Markdown

@chopmob-cloud chopmob-cloud commented May 30, 2026

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.

  • Closed four-state enum: TRUSTED / PROVISIONAL / INSUFFICIENT_EVIDENCE / UNTRUSTED
  • issuer_references array carries content-addressed references to each upstream attestation considered
  • Canonicalised under urn:x402:canonicalisation:jcs-rfc8785-v1 (RFC 8785 JCS), byte-for-byte cross-validated across 8 independent implementations
  • Composes Compliance Receipt, Settlement Attestation, and counterparty-risk evidence into a single verifiable envelope

Normative 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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/ap2/trust_query.md
"issuer_id": "did:web:api.algovoi.co.uk"
}
],
"signature": "<detached signature over JCS canonical bytes>",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment thread docs/ap2/trust_query.md Outdated
Comment on lines +141 to +143
- 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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant