pub struct TrustRegistry { /* private fields */ }Expand description
Trust directory: known agents, a revocation list (CRL), and chain policy.
Immutable after construction (builder methods return a new registry), so it
can be shared freely behind an Arc.
Implementations§
Source§impl TrustRegistry
impl TrustRegistry
Sourcepub fn new(config: TrustConfig) -> Self
pub fn new(config: TrustConfig) -> Self
Create an empty registry with the given policy.
Sourcepub fn with_agent(self, agent: TrustedAgent) -> Self
pub fn with_agent(self, agent: TrustedAgent) -> Self
Register a trusted agent (builder style).
Sourcepub fn revoke(self, url: &str) -> Self
pub fn revoke(self, url: &str) -> Self
Revoke an agent’s credentials (CRL). Returns a new registry.
Sourcepub fn is_trusted(&self, url: &str) -> bool
pub fn is_trusted(&self, url: &str) -> bool
Whether url is a known, non-revoked agent.
Sourcepub fn verify_card(
&self,
card: &AgentCard,
) -> Result<TrustVerification, SecurityError>
pub fn verify_card( &self, card: &AgentCard, ) -> Result<TrustVerification, SecurityError>
Verify a single card against the registry entry for its own url.
The directory attests to the agent’s identity: the card must belong to a known, non-revoked agent and its signature must verify against the key registered for that agent.
Sourcepub fn verify_chain(
&self,
cards: &[&AgentCard],
) -> Result<TrustVerification, SecurityError>
pub fn verify_chain( &self, cards: &[&AgentCard], ) -> Result<TrustVerification, SecurityError>
Verify a delegation chain root -> … -> leaf of cards.
Every hop must be a known, non-revoked agent. The root card must verify
against its own registered key; each subsequent card must verify against
the previous hop’s key (the parent issued the child’s certificate).
The number of hops is bounded by TrustConfig::max_delegation_depth,
and the returned score is decayed once per hop.
Sourcepub fn trust_score(&self, url: &str, hops: usize) -> Option<f64>
pub fn trust_score(&self, url: &str, hops: usize) -> Option<f64>
Effective trust score for a known agent after hops of delegation, or
None if the agent is unknown or revoked.
Sourcepub fn issue_card(
&self,
issuer_url: &str,
card: &mut AgentCard,
) -> Result<(), SecurityError>
pub fn issue_card( &self, issuer_url: &str, card: &mut AgentCard, ) -> Result<(), SecurityError>
Convenience: sign a card as “issued” by issuer_url (certificate
issuance analog). The card’s signature is computed with the issuer’s
registered key, which is what Self::verify_chain expects of a child.