#[non_exhaustive]pub struct ProviderTrustSignal {
pub provider: PublicKey,
pub signal: TrustSignalKind,
pub hash: Option<Hash>,
pub reporter: PublicKey,
pub timestamp: u64,
pub sequence: u64,
pub signature: Option<String>,
}Expand description
A fetch or integrity observation published by a trusted reporter.
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§signal: TrustSignalKind§hash: Option<Hash>§reporter: PublicKey§timestamp: u64§sequence: u64§signature: Option<String>Implementations§
Source§impl ProviderTrustSignal
impl ProviderTrustSignal
Sourcepub fn new(
provider: PublicKey,
kind: TrustSignalKind,
hash: Option<Hash>,
reporter: PublicKey,
timestamp: u64,
sequence: u64,
) -> Result<Self>
pub fn new( provider: PublicKey, kind: TrustSignalKind, hash: Option<Hash>, reporter: PublicKey, timestamp: u64, sequence: u64, ) -> Result<Self>
Create an unsigned signal and validate its structure.
§Errors
Returns an error when the signal structure is invalid.
Sourcepub fn new_with_time(
provider: PublicKey,
kind: TrustSignalKind,
hash: Option<Hash>,
sequence: u64,
signing_key: &SigningKey,
) -> Result<Self>
pub fn new_with_time( provider: PublicKey, kind: TrustSignalKind, hash: Option<Hash>, sequence: u64, signing_key: &SigningKey, ) -> Result<Self>
Create and sign a signal using the current time.
§Errors
Returns an error when the signal structure is invalid or signing fails.
Sourcepub fn from_trust_record(
record: &ProviderTrustRecord,
signing_key: &SigningKey,
) -> Result<Self>
pub fn from_trust_record( record: &ProviderTrustRecord, signing_key: &SigningKey, ) -> Result<Self>
Create a signed trust signal from a local provider trust record.
Maps ProviderTrustAction::Vouch to ObservedSuccess (positive
observation) and ProviderTrustAction::Distrust to ObservedFailure
(negative observation). Only vouch and distrust records can be
converted; Trust, Warn, and other actions return an error.
§Errors
Returns an error when the action is not vouch/distrust or when signing fails.
Sourcepub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
pub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
§Errors
Returns an error when the signing key does not match the reporter.
Sourcepub fn sign_with_secret_key(&mut self, secret_key: &SecretKey) -> Result<()>
pub fn sign_with_secret_key(&mut self, secret_key: &SecretKey) -> Result<()>
§Errors
Returns an error when the signing key does not match the reporter.
Sourcepub fn verify(&self) -> Result<()>
pub fn verify(&self) -> Result<()>
§Errors
Returns an error when the signal is malformed, expired, or unsigned.
Sourcepub fn verify_at(&self, now: u64) -> Result<()>
pub fn verify_at(&self, now: u64) -> Result<()>
§Errors
Returns an error when the signal is malformed, expired, or unsigned.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
§Errors
Returns an error when an identity or sequence is invalid.
Trait Implementations§
Source§impl Clone for ProviderTrustSignal
impl Clone for ProviderTrustSignal
Source§fn clone(&self) -> ProviderTrustSignal
fn clone(&self) -> ProviderTrustSignal
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 ProviderTrustSignal
impl Debug for ProviderTrustSignal
Source§impl<'de> Deserialize<'de> for ProviderTrustSignal
impl<'de> Deserialize<'de> for ProviderTrustSignal
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 ProviderTrustSignal
Source§impl PartialEq for ProviderTrustSignal
impl PartialEq for ProviderTrustSignal
Source§impl Serialize for ProviderTrustSignal
impl Serialize for ProviderTrustSignal
impl StructuralPartialEq for ProviderTrustSignal
Auto Trait Implementations§
impl Freeze for ProviderTrustSignal
impl RefUnwindSafe for ProviderTrustSignal
impl Send for ProviderTrustSignal
impl Sync for ProviderTrustSignal
impl Unpin for ProviderTrustSignal
impl UnsafeUnpin for ProviderTrustSignal
impl UnwindSafe for ProviderTrustSignal
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