pub struct TrustPolicy { /* private fields */ }Expand description
Local trust roots and cryptographically signed delegations.
Implementations§
Source§impl TrustPolicy
impl TrustPolicy
Sourcepub fn with_root(signing_key: &SigningKey) -> Self
pub fn with_root(signing_key: &SigningKey) -> Self
Create a policy with one trusted root.
Trust an author directly as a local root.
Revoke a local trust root or delegate identity.
Sourcepub fn add_delegation(&mut self, delegation: TrustDelegation) -> Result<bool>
pub fn add_delegation(&mut self, delegation: TrustDelegation) -> Result<bool>
Add a signed delegation issued by an already trusted author.
§Errors
Returns an error if the delegation is invalid, expired, or not issued by an identity trusted for its scope.
Sourcepub fn revoke_delegation(
&mut self,
delegator: &str,
delegate: &str,
scope: Option<&Hash>,
) -> Result<bool>
pub fn revoke_delegation( &mut self, delegator: &str, delegate: &str, scope: Option<&Hash>, ) -> Result<bool>
Revoke an active delegation matching the delegate, scope, and delegator.
Returns true if any delegation was marked revoked.
§Errors
This method does not return errors.
Sourcepub fn revoke_delegation_at(
&mut self,
delegator: &str,
delegate: &str,
scope: Option<&Hash>,
at: u64,
) -> Result<bool>
pub fn revoke_delegation_at( &mut self, delegator: &str, delegate: &str, scope: Option<&Hash>, at: u64, ) -> Result<bool>
Revoke a delegation using an explicit revocation time.
Returns true if any delegation was marked revoked.
§Errors
This method does not return errors.
Sourcepub fn add_delegation_at(
&mut self,
delegation: TrustDelegation,
now: u64,
) -> Result<bool>
pub fn add_delegation_at( &mut self, delegation: TrustDelegation, now: u64, ) -> Result<bool>
Add a signed delegation using an explicit validation time.
§Errors
Returns an error if the delegation is invalid, expired, or not issued by an identity trusted for its scope.
Sourcepub fn evaluate(&self, author: &str) -> TrustDecision
pub fn evaluate(&self, author: &str) -> TrustDecision
Return the local trust decision for an author.
Sourcepub fn evaluate_at(&self, author: &str, now: u64) -> TrustDecision
pub fn evaluate_at(&self, author: &str, now: u64) -> TrustDecision
Return the local trust decision at an explicit time.
Sourcepub fn evaluate_for(
&self,
author: &str,
content: Option<&Hash>,
) -> TrustDecision
pub fn evaluate_for( &self, author: &str, content: Option<&Hash>, ) -> TrustDecision
Return the local trust decision for an author and optional content.
Sourcepub fn evaluate_for_at(
&self,
author: &str,
content: Option<&Hash>,
now: u64,
) -> TrustDecision
pub fn evaluate_for_at( &self, author: &str, content: Option<&Hash>, now: u64, ) -> TrustDecision
Return the local trust decision for an author and content at an explicit time.
Trait Implementations§
Source§impl Clone for TrustPolicy
impl Clone for TrustPolicy
Source§fn clone(&self) -> TrustPolicy
fn clone(&self) -> TrustPolicy
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 TrustPolicy
impl Debug for TrustPolicy
Source§impl Default for TrustPolicy
impl Default for TrustPolicy
Source§fn default() -> TrustPolicy
fn default() -> TrustPolicy
Auto Trait Implementations§
impl Freeze for TrustPolicy
impl RefUnwindSafe for TrustPolicy
impl Send for TrustPolicy
impl Sync for TrustPolicy
impl Unpin for TrustPolicy
impl UnsafeUnpin for TrustPolicy
impl UnwindSafe for TrustPolicy
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,
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