#[non_exhaustive]pub struct ProviderTrustRecord {
pub provider: PublicKey,
pub action: ProviderTrustAction,
pub scope: Option<Hash>,
pub issuer: String,
pub sequence: u64,
pub issued_at: u64,
pub expires_at: Option<u64>,
pub reason: String,
pub signature: Option<String>,
}Expand description
A signed provider reliability record in the local Web-of-Trust.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.provider: PublicKey§action: ProviderTrustAction§scope: Option<Hash>§issuer: String§sequence: u64§issued_at: u64§expires_at: Option<u64>§reason: String§signature: Option<String>Implementations§
Source§impl ProviderTrustRecord
impl ProviderTrustRecord
Sourcepub fn new(
provider: PublicKey,
action: ProviderTrustAction,
scope: Option<Hash>,
sequence: u64,
expires_at: Option<u64>,
reason: impl Into<String>,
signing_key: &SigningKey,
) -> Result<Self>
pub fn new( provider: PublicKey, action: ProviderTrustAction, scope: Option<Hash>, sequence: u64, expires_at: Option<u64>, reason: impl Into<String>, signing_key: &SigningKey, ) -> Result<Self>
Create and sign a provider trust record using the current time.
§Errors
Returns an error if the record is invalid or signing fails.
Sourcepub fn new_with_time(
provider: PublicKey,
action: ProviderTrustAction,
scope: Option<Hash>,
sequence: u64,
issued_at: u64,
reason: impl Into<String>,
signing_key: &SigningKey,
) -> Result<Self>
pub fn new_with_time( provider: PublicKey, action: ProviderTrustAction, scope: Option<Hash>, sequence: u64, issued_at: u64, reason: impl Into<String>, signing_key: &SigningKey, ) -> Result<Self>
Create and sign a provider trust record with an explicit issue time.
§Errors
Returns an error if the record is invalid or signing fails.
Sourcepub fn with_expiration(
self,
expires_at: Option<u64>,
signing_key: &SigningKey,
) -> Result<Self>
pub fn with_expiration( self, expires_at: Option<u64>, signing_key: &SigningKey, ) -> Result<Self>
Add or replace an expiration time and re-sign the record.
§Errors
Returns an error when the expiration is invalid or signing fails.
Sourcepub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
pub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
Sign the record with its declared issuer.
§Errors
Returns an error when the signing key does not match the issuer.
Sourcepub fn verify_signature(&self) -> Result<()>
pub fn verify_signature(&self) -> Result<()>
Verify the cryptographic signature.
§Errors
Returns an error when the record is malformed or unsigned.
Sourcepub fn verify(&self) -> Result<()>
pub fn verify(&self) -> Result<()>
Verify the signature and require the record to be active now.
§Errors
Returns an error when the record is malformed, unsigned, or expired.
Sourcepub fn verify_at(&self, now: u64) -> Result<()>
pub fn verify_at(&self, now: u64) -> Result<()>
Verify the signature and reject expired records.
§Errors
Returns an error when the record is malformed, unsigned, or expired.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate non-cryptographic record fields.
§Errors
Returns an error when an identity, sequence, reason, or timestamp is invalid.
Trait Implementations§
Source§impl Clone for ProviderTrustRecord
impl Clone for ProviderTrustRecord
Source§fn clone(&self) -> ProviderTrustRecord
fn clone(&self) -> ProviderTrustRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderTrustRecord
impl Debug for ProviderTrustRecord
Source§impl<'de> Deserialize<'de> for ProviderTrustRecord
impl<'de> Deserialize<'de> for ProviderTrustRecord
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>,
impl Eq for ProviderTrustRecord
Source§impl PartialEq for ProviderTrustRecord
impl PartialEq for ProviderTrustRecord
Source§impl Serialize for ProviderTrustRecord
impl Serialize for ProviderTrustRecord
impl StructuralPartialEq for ProviderTrustRecord
Auto Trait Implementations§
impl Freeze for ProviderTrustRecord
impl RefUnwindSafe for ProviderTrustRecord
impl Send for ProviderTrustRecord
impl Sync for ProviderTrustRecord
impl Unpin for ProviderTrustRecord
impl UnsafeUnpin for ProviderTrustRecord
impl UnwindSafe for ProviderTrustRecord
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more