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§
source§impl 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> ⓘ
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§
source§impl<'de> Deserialize<'de> for Trust
impl<'de> Deserialize<'de> for Trust
source§fn 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