Struct trust_graph::Trust[][src]

pub struct Trust {
    pub issued_for: PublicKey,
    pub expires_at: Duration,
    pub signature: Signature,
    pub issued_at: Duration,
}

One element in chain of trust in a certificate. TODO delete pk from Trust (it is already in a trust node)

Fields

issued_for: PublicKey

For whom this certificate is issued

expires_at: Duration

Expiration date of a trust.

signature: Signature

Signature of a previous trust in a chain. Signature is self-signed if it is a root trust.

issued_at: Duration

Creation time of a trust

Implementations

impl Trust[src]

pub fn new(
    issued_for: PublicKey,
    expires_at: Duration,
    issued_at: Duration,
    signature: Signature
) -> Self
[src]

pub fn create(
    issued_by: &KeyPair,
    issued_for: PublicKey,
    expires_at: Duration,
    issued_at: Duration
) -> Self
[src]

pub fn verify(
    trust: &Trust,
    issued_by: &PublicKey,
    cur_time: Duration
) -> Result<(), TrustError>
[src]

Verifies that authorization is cryptographically correct.

pub fn encode(&self) -> Vec<u8>[src]

Encode the trust into a byte array

pub fn decode(arr: &[u8]) -> Result<Self, TrustError>[src]

Decode a trust from a byte array as produced by encode.

pub fn convert_from_strings(
    issued_for: &str,
    signature: &str,
    expires_at: &str,
    issued_at: &str
) -> Result<Self, TrustError>
[src]

Trait Implementations

impl Clone for Trust[src]

impl Debug for Trust[src]

impl<'de> Deserialize<'de> for Trust[src]

impl Eq for Trust[src]

impl PartialEq<Trust> for Trust[src]

impl Serialize for Trust[src]

impl StructuralEq for Trust[src]

impl StructuralPartialEq for Trust[src]

impl ToString for Trust[src]

Auto Trait Implementations

impl RefUnwindSafe for Trust

impl Send for Trust

impl Sync for Trust

impl Unpin for Trust

impl UnwindSafe for Trust

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,