Skip to main content

Module provenance

Module provenance 

Source
Expand description

Who made a message or an artifact, and whether a machine did: a marker, and a signature over the content that carries it.

§The gap this closes

A2A authenticates the connection. Nothing in a message or an artifact says which agent produced it, survives being forwarded through a second agent, or shows that it was not altered by an intermediary that terminated TLS. And nothing marks content as machine-generated, which the EU AI Act asks providers of generative systems to do “in a machine-readable format” (Article 50(2)).

§Wire shape

Not part of A2A v1.0, so it ships as the declared extension https://a2a-rust.com/extensions/provenance/v1, in the same style as failure: a value in metadata under a2a-rust.com/provenance, the URI in extensions.

"metadata": { "a2a-rust.com/provenance": {
  "aiGenerated": true,
  "generator": "billing-agent/2.3 (model: example-model-v1)",
  "signature": { "protected": "eyJhbGciOiJFZERTQSIsImtpZCI6ImsxIn0", "signature": "…" }
} }

The signature is a JWS (RFC 7515, detached payload) over the RFC 8785 canonical JSON of the whole message or artifact with only signature removed, so it covers the marker too: stripping aiGenerated breaks it. ES256 or EdDSA, verified against a JWK Set (signing::Jwks, with the signing feature) by kid.

What it does not do: it says which key signed, not that the content is true; a verifier still decides which keys to trust. The canonical form is of the JSON this crate’s types serialize, so content another implementation extended with fields these types do not model will not verify after a round trip through them. It is not C2PA: a file part’s bytes, and any C2PA manifest embedded in them, are carried as they are.

use a2a_protocol_types::message::Message;
use a2a_protocol_types::provenance::{mark_ai_generated, provenance_of};

let mut reply = Message::agent_text("m1", "Your refund was issued.");
mark_ai_generated(&mut reply, Some("billing-agent/2.3"));
let p = provenance_of(&reply).unwrap().expect("marked");
assert!(p.ai_generated);

Structs§

ContentSignature
A detached-payload JWS: the protected header and the signature, both base64url.
ContentSigner
A private key that signs content provenance.
Provenance
What a message or artifact says about its origin.

Constants§

PROVENANCE_EXTENSION_URI
The extension URI a card declares and content names in extensions.
PROVENANCE_METADATA_KEY
The metadata key the provenance travels under.

Traits§

Content
Content that can carry provenance: Message and Artifact.

Functions§

mark_ai_generated
Marks content as generated by an AI system, naming the generator.
provenance_of
The provenance content carries, if any.
sign_content
Signs content in place: the provenance it carries (or an empty one, aiGenerated: false, when it carries none) gains a signature over the whole content.
verify_content
Verifies the signature content carries against the keys of jwks with its kid and alg, and returns the provenance it vouches for.