Struct trust_graph::Trust
source · [−]pub struct Trust {
pub issued_for: PublicKey,
pub expires_at: Duration,
pub signature: Signature,
pub issued_at: Duration,
}Expand description
One element in chain of trust in a certificate. TODO delete pk from Trust (it is already in a trust node)
Fields
issued_for: PublicKeyFor whom this certificate is issued
expires_at: DurationExpiration date of a trust.
signature: SignatureSignature of a previous trust in a chain. Signature is self-signed if it is a root trust.
issued_at: DurationCreation time of a trust
Implementations
sourceimpl Trust
impl Trust
pub fn new(
issued_for: PublicKey,
expires_at: Duration,
issued_at: Duration,
signature: Signature
) -> Self
pub fn create(
issued_by: &KeyPair,
issued_for: PublicKey,
expires_at: Duration,
issued_at: Duration
) -> Self
sourcepub fn verify(
trust: &Trust,
issued_by: &PublicKey,
cur_time: Duration
) -> Result<(), TrustError>
pub fn verify(
trust: &Trust,
issued_by: &PublicKey,
cur_time: Duration
) -> Result<(), TrustError>
Verifies that authorization is cryptographically correct.
pub fn signature_bytes(
pk: &PublicKey,
expires_at: Duration,
issued_at: Duration
) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
sourcepub fn encode(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn encode(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Encode the trust into a byte array
sourcepub fn decode(arr: &[u8]) -> Result<Self, TrustError>
pub fn decode(arr: &[u8]) -> Result<Self, TrustError>
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>
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Trust
impl<'de> Deserialize<'de> for Trust
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Trust
impl StructuralEq for Trust
impl StructuralPartialEq for Trust
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more