Expand description
§turul-ai-catalog-trust
Trust for AI Catalog documents: sign a catalog or a trust manifest,
accept a signature against the signer’s did:web DID document, check artifact digests, and build
a per-signature trust report for a resolved catalog tree. Built on
turul-ai-catalog and turul-ai-catalog-client.
Part of turul-agent-card.
The crate implements the did-web-v1 signature profile: ES256 detached JWS over the RFC 8785
canonical form of the signed object, with the signer’s key taken from its root did:web
DID document. Every outcome is reported per signature; there is no catalog-wide verdict.
§Quick start
cargo add turul-ai-catalog-trustSign a catalog, then accept the signature against the signer’s DID document. The DID document
is built in memory here; resolve fetches the real one over HTTPS.
use std::time::{Duration, UNIX_EPOCH};
use turul_ai_catalog::identity::{ArtifactType, EntryIdentifier};
use turul_ai_catalog::model::{AiCatalog, ArtifactSource, CatalogEntry};
use turul_ai_catalog_client::Fetched;
use turul_ai_catalog_trust::{
DidWebRoot, SignedObject, SignerParams, SigningKey, TrustPolicy, accept_document, sign_catalog,
verify_signature,
};
let signer = DidWebRoot::parse("did:web:example.com").ok_or("not a root did:web DID")?;
let catalog = AiCatalog::new(vec![CatalogEntry::new(
EntryIdentifier::new("urn:air:example.com:a2a:research"),
ArtifactType::A2A_AGENT_CARD,
ArtifactSource::Url("https://agents.example.com/.well-known/agent-card.json".into()),
)]);
let params = SignerParams {
signer: signer.clone(),
key_fragment: "key-1".into(),
issued_at: "2026-09-12T10:00:00Z".into(),
expires_at: None,
};
let signed = sign_catalog(catalog, ¶ms, &SigningKey::from_pkcs8_der(&KEY_DER))?;
// The DID document the signer would publish at https://example.com/.well-known/did.json.
let did_json = format!(
r#"{{"id":"did:web:example.com","verificationMethod":[{{"id":"did:web:example.com#key-1",
"type":"JsonWebKey2020","controller":"did:web:example.com","publicKeyJwk":{PUBLIC_JWK}}}],
"assertionMethod":["did:web:example.com#key-1"]}}"#
);
let fetched = Fetched::new(200, Some("application/did+json".into()), did_json.into_bytes());
let doc = accept_document(&fetched, &signer)?;
let now = UNIX_EPOCH + Duration::from_secs(1_789_207_200);
let accepted = verify_signature(SignedObject::Catalog(&signed), &doc, &TrustPolicy::default(), now)?;
assert_eq!(accepted.kid.as_str(), "did:web:example.com#key-1");For a whole resolved tree, verify fetches each signer’s DID document once and returns a
TrustReport with one signature outcome per catalog and per trust manifest, grouped by entry.
§Modules
| Module | Purpose |
|---|---|
payload | The canonical bytes a detached JWS covers. |
sign | ES256 signing of a manifest or a catalog. |
header | The JWS protected-header policy and kid check. |
did_web | DID document retrieval, acceptance and verification-key selection. |
accept | Acceptance of one signature under a TrustPolicy. |
digest | Artifact digests and integrity checks. |
report | Entry coverage, publisher authority, endorsement, the trust report and verify_entry. |
endorse | endorse_entry and endorse_catalog: digest and publisher manifest per entry. |
parameter_store | Feature ssm: the signing key held in an SSM Parameter Store SecureString. |
registration | Feature registration: the publisher verifier for runtime registration. |
identity | did:web root and urn:air identifier shapes. |
§Feature flags
registration(off by default):DidWebPublisherVerifier, thePublisherVerifierofturul-ai-catalog-storage. It accepts an entry only when itsurn:airpublisher signed a trust manifest that covers it. Addsturul-ai-catalog-storage(without default features, so without a backend),async-traitandtokio(rt).ssm(off by default):ParameterKeyStore, which creates the signing key as a SecureString (never overwriting one) and loads it in process. Addsaws-sdk-ssm.
§Licence
Apache-2.0.
Re-exports§
pub use accept::AcceptedSignature;pub use accept::Reason;pub use accept::TrustPolicy;pub use accept::verify_signature;pub use did_web::DidDocument;pub use did_web::KeySelectionError;pub use did_web::PublicJwk;pub use did_web::ResolveError;pub use did_web::accept_document;pub use did_web::did_document;pub use did_web::document_url;pub use did_web::resolve;pub use did_web::select_key;pub use digest::IntegrityError;pub use digest::Unsupported;pub use digest::artifact_digest;pub use digest::check_artifact;pub use digest::compute;pub use digest::fetch_artifact;pub use digest::verify_artifact;pub use endorse::EndorseError;pub use endorse::EndorseErrorKind;pub use endorse::endorse_catalog;pub use endorse::endorse_entry;pub use header::DID_WEB_V1_FORBIDDEN_HEADERS;pub use header::ES256;pub use header::HeaderError;pub use header::Kid;pub use header::TYP_CATALOG;pub use header::TYP_TRUST_MANIFEST;pub use header::inspect;pub use header::kid_matches_signer;pub use header::policy;pub use identity::DidWebRoot;pub use object::SignedObject;pub use parameter_store::KeyStoreError;pub use parameter_store::ParameterKeyStore;pub use payload::PayloadError;pub use payload::catalog_payload;pub use payload::manifest_payload;pub use registration::DidWebPublisherVerifier;pub use registration::publisher_verdict;pub use report::CatalogReport;pub use report::Coverage;pub use report::CoverageGap;pub use report::DidDocuments;pub use report::Endorsement;pub use report::EntryReport;pub use report::ManifestReport;pub use report::Selection;pub use report::SignatureOutcome;pub use report::TrustReport;pub use report::catalog_endorsed;pub use report::entry_release_coverage;pub use report::select_current;pub use report::verify;pub use report::verify_entry;pub use report::verify_entry_resolved;pub use report::verify_resolved;pub use sign::SignError;pub use sign::SignerParams;pub use sign::SigningKey;pub use sign::sign_catalog;pub use sign::sign_manifest;
Modules§
- accept
- Acceptance of one signature (#verification-procedures, #profile-selection,
#signature-acceptance-and-time): every refusal is a per-signature
Reason, never a catalog-wide verdict. - did_web
did:webresolution, the DID document the profile reads, and verification-key selection (#did-document-resolution-and-key-selection, #current-state-verification).- digest
- Artifact digests and integrity (#digest-format, #verifying-artifact-integrity).
- endorse
- Endorsing the entries of a catalog: the artifact digest and the signer’s own trust manifest (#entry-release-coverage, #level-3-trusted-catalog).
- header
- The JWS protected header of a
did-web-v1signature (#signed-payload-and-jws-construction, #jws-algorithm-and-key-requirements). Parsing and every header rule butkidbelong to the JWS validator; this module builds its policy and checkskid. - identity
- Signer identity: a root
did:webDID. - object
- The two kinds of object that carry a signature.
- parameter_
store - The signing key held in AWS Systems Manager Parameter Store as a
SecureString. - payload
- The bytes a detached JWS covers (#signed-payload-and-jws-construction, #catalog-snapshot-coverage).
- registration
- The publisher verifier for runtime registration: a stored entry is accepted when its
urn:airpublisher signed a trust manifest that covers it (#the-did-web-publisher-profile). - report
- Coverage, authority, endorsement, selection among updates and the per-entry trust report (#entry-release-coverage, #the-did-web-publisher-profile, #catalog-authorization, #independent-contributions-and-updates, #verification-result). The report holds one outcome per signature and no catalog-wide verdict.
- sign
- ES256 signing of a manifest or a catalog (#signed-payload-and-jws-construction).