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: 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§
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
impl Eq for Trust
impl StructuralPartialEq for Trust
Auto Trait Implementations§
impl Freeze for Trust
impl RefUnwindSafe for Trust
impl Send for Trust
impl Sync for Trust
impl Unpin for Trust
impl UnwindSafe for Trust
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more