Shared domain types for the Agent Name Service (ANS) ecosystem.
This crate provides the foundational types used across all ANS crates. It defines the core domain vocabulary with a small dependency set (serde for serialization, sha2/hex/subtle for fingerprints, chrono/url/uuid for domain types).
Validated Fully Qualified Domain Name. Normalizes to lowercase and strips trailing dots.
use ans_types::Fqdn;
let fqdn = Fqdn::new("agent.example.com")?;
assert_eq!(fqdn.ans_badge_name(), "_ans-badge.agent.example.com");
assert_eq!(fqdn.tlsa_name(443), "_443._tcp.agent.example.com");Semantic version (major.minor.patch) with comparison support.
use ans_types::Version;
let v = Version::parse("v1.2.3")?; // "v" prefix is optional
assert_eq!(v.to_string(), "v1.2.3");
assert!(Version::parse("1.0.0")? < Version::parse("2.0.0")?);ANS URI format parser for ans://v{version}.{fqdn} URIs found in certificate Subject Alternative Names.
use ans_types::AnsName;
let name = AnsName::parse("ans://v1.0.0.agent.example.com")?;
assert_eq!(name.fqdn().as_str(), "agent.example.com");
assert_eq!(*name.version(), ans_types::Version::new(1, 0, 0));Transparency log badge containing agent metadata, certificate attestations, and status. Deserialized from the Transparency Log API response.
Key fields:
status—Active,Warning,Deprecated,Expired, orRevokedpayload.attestations— Server and identity certificate fingerprintspayload.agent— Agent host, version, endpoints
SHA-256 certificate fingerprint with case-insensitive comparison.
use ans_types::CertFingerprint;
// Compute from DER bytes
let fp = CertFingerprint::from_der(der_bytes);
// Parse from string
let fp = CertFingerprint::parse("SHA256:abcd...")?;
assert!(fp.matches("sha256:ABCD...")); // case-insensitiveParseError— Invalid FQDN, version, ANS name, or URL formatCryptoError— Certificate parsing failures, invalid fingerprints, missing extensions
MIT