[][src]Struct trust_graph::TrustGraph

pub struct TrustGraph { /* fields omitted */ }

Graph to efficiently calculate weights of certificates and get chains of certificates. TODO serialization/deserialization TODO export a certificate from graph

Implementations

impl TrustGraph[src]

pub fn new(root_weights: Vec<(PublicKey, u32)>) -> Self[src]

pub fn add_root_weights<P: Into<PublicKeyHashable>>(
    &mut self,
    weights: Vec<(P, u32)>
)
[src]

Insert new root weights

pub fn get(&self, pk: PublicKey) -> Option<&TrustNode>[src]

Get trust by public key

pub fn add<C>(&mut self, cert: C, cur_time: Duration) -> Result<(), String> where
    C: Borrow<Certificate>, 
[src]

Certificate is a chain of trusts, add this chain to graph

pub fn weight<P>(&self, pk: P) -> Option<u32> where
    P: Borrow<PublicKey>, 
[src]

Get the maximum weight of trust for one public key.

pub fn certificates_weight<C, I>(&self, certs: I) -> Option<u32> where
    C: Borrow<Certificate>,
    I: IntoIterator<Item = C>, 
[src]

Calculate weight from given certificates Returns None if there is no such public key or some trust between this key and a root key is revoked. TODO handle non-direct revocations

pub fn get_all_certs<P>(
    &self,
    issued_for: P,
    roots: &[PublicKey]
) -> Vec<Certificate> where
    P: Borrow<PublicKey>, 
[src]

Get all possible certificates where issued_for will be the last element of the chain and one of the destinations is the root of this chain.

pub fn revoke(&mut self, revoke: Revoke) -> Result<(), String>[src]

Mark public key as revoked.

Trait Implementations

impl Debug for TrustGraph[src]

impl Default for TrustGraph[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,