pub struct TrustGraph { /* private fields */ }Expand description
The trust graph: authorities and delegation edges forming a DAG.
Implementations§
Source§impl TrustGraph
impl TrustGraph
Sourcepub fn add_node(&mut self, node: AuthorityNode)
pub fn add_node(&mut self, node: AuthorityNode)
Insert a node, replacing any node with the same identifier.
Sourcepub fn add_delegation(&mut self, edge: DelegationEdge) -> SignatifResult<()>
pub fn add_delegation(&mut self, edge: DelegationEdge) -> SignatifResult<()>
Insert a delegation edge. Returns an error when either endpoint is unknown or when the edge would create a cycle.
§Errors
SignatifError::Encoding for unknown endpoints or a cycle.
Sourcepub fn nodes(&self) -> impl Iterator<Item = &AuthorityNode>
pub fn nodes(&self) -> impl Iterator<Item = &AuthorityNode>
All nodes.
Sourcepub fn edges(&self) -> &[DelegationEdge]
pub fn edges(&self) -> &[DelegationEdge]
All delegation edges.
Sourcepub fn node(&self, id: &str) -> Option<&AuthorityNode>
pub fn node(&self, id: &str) -> Option<&AuthorityNode>
Look up a node by identifier.
Sourcepub fn parents_of(&self, child: &str) -> Vec<&DelegationEdge>
pub fn parents_of(&self, child: &str) -> Vec<&DelegationEdge>
Incoming delegation edges for a child node.
Sourcepub fn is_acyclic(&self) -> bool
pub fn is_acyclic(&self) -> bool
Cycle detection over the delegation graph.
Sourcepub fn find_paths(
&self,
signer: &str,
bundle: &TrustAnchorBundle,
verifier: &dyn SignatureVerifier,
) -> SignatifResult<Vec<VerificationPath>>
pub fn find_paths( &self, signer: &str, bundle: &TrustAnchorBundle, verifier: &dyn SignatureVerifier, ) -> SignatifResult<Vec<VerificationPath>>
Find all verification paths from signer to roots present in
bundle. Each link is validated: the parent’s delegation
signature over the child’s binding bytes, the monotonic scope
narrowing invariant, and — for the terminal link — that the root
matches an anchor in the bundle by aggregate key.
§Errors
Returns SignatifError::ScopeWidening on the first widening
link (a hard failure), and SignatifError::BadSignature when
a delegation credential does not verify.
Trait Implementations§
Source§impl Clone for TrustGraph
impl Clone for TrustGraph
Source§fn clone(&self) -> TrustGraph
fn clone(&self) -> TrustGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more