ans-types
Shared domain types for the Agent Name Service (ANS) ecosystem.
Overview
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).
Types
Fqdn
Validated Fully Qualified Domain Name. Normalizes to lowercase and strips trailing dots.
use Fqdn;
let fqdn = new?;
assert_eq!;
assert_eq!;
Version
Semantic version (major.minor.patch) with comparison support.
use Version;
let v = parse?; // "v" prefix is optional
assert_eq!;
assert!;
AnsName
ANS URI format parser for ans://v{version}.{fqdn} URIs found in certificate Subject Alternative Names.
use AnsName;
let name = parse?;
assert_eq!;
assert_eq!;
Badge
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
CertFingerprint
SHA-256 certificate fingerprint with case-insensitive comparison.
use CertFingerprint;
// Compute from DER bytes
let fp = from_der;
// Parse from string
let fp = parse?;
assert!; // case-insensitive
Error Types
ParseError— Invalid FQDN, version, ANS name, or URL formatCryptoError— Certificate parsing failures, invalid fingerprints, missing extensions
License
MIT