pub struct WotService { /* private fields */ }Expand description
Indexing-layer service for trusted metadata and local governance records.
Implementations§
Source§impl WotService
impl WotService
Sourcepub fn new(indexing: &IndexingService, policy: TrustPolicy) -> Self
pub fn new(indexing: &IndexingService, policy: TrustPolicy) -> Self
Create a Web-of-Trust service using an existing indexing service.
Sourcepub fn with_database(database: IndexingDatabase, policy: TrustPolicy) -> Self
pub fn with_database(database: IndexingDatabase, policy: TrustPolicy) -> Self
Create a service backed by an indexing database.
Sourcepub fn in_memory(policy: TrustPolicy) -> Result<Self>
pub fn in_memory(policy: TrustPolicy) -> Result<Self>
Create an isolated in-memory Web-of-Trust service.
§Errors
Returns an error if SQLite cannot initialize.
pub const fn database(&self) -> &IndexingDatabase
Sourcepub fn policy(&self) -> Result<TrustPolicy>
pub fn policy(&self) -> Result<TrustPolicy>
Return a copy of the current local trust policy.
§Errors
Returns an error if policy state is poisoned.
Sourcepub fn add_delegation(&self, delegation: TrustDelegation) -> Result<bool>
pub fn add_delegation(&self, delegation: TrustDelegation) -> Result<bool>
Add a signed delegation to the local policy.
§Errors
Returns an error if the delegation is invalid or its issuer is not locally trusted.
Sourcepub fn add_delegation_at(
&self,
delegation: TrustDelegation,
now: u64,
) -> Result<bool>
pub fn add_delegation_at( &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 or its issuer is not locally trusted.
Sourcepub fn revoke_delegation(
&self,
delegator: &str,
delegate: &str,
scope: Option<&Hash>,
) -> Result<bool>
pub fn revoke_delegation( &self, delegator: &str, delegate: &str, scope: Option<&Hash>, ) -> Result<bool>
Revoke a delegation matching the delegate, scope, and delegator.
Returns true if any delegation was marked revoked.
§Errors
Returns an error if the policy lock is poisoned.
Sourcepub fn revoke_delegation_at(
&self,
delegator: &str,
delegate: &str,
scope: Option<&Hash>,
at: u64,
) -> Result<bool>
pub fn revoke_delegation_at( &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
Returns an error if the policy lock is poisoned.
Sourcepub fn apply_provider_trust(&self, record: ProviderTrustRecord) -> Result<bool>
pub fn apply_provider_trust(&self, record: ProviderTrustRecord) -> Result<bool>
Apply a signed manual provider trust record from a trusted issuer.
A provider may always publish a signed self-distrust, which allows a compromised or retiring provider to withdraw its own availability.
§Errors
Returns an error when the record is invalid or its issuer is untrusted.
Sourcepub fn evaluate_provider_trust(
&self,
provider: PublicKey,
hash: Option<&Hash>,
now: u64,
) -> Result<ProviderTrustDecision>
pub fn evaluate_provider_trust( &self, provider: PublicKey, hash: Option<&Hash>, now: u64, ) -> Result<ProviderTrustDecision>
Evaluate the newest applicable provider trust records.
§Errors
Returns an error when the WoT state lock is poisoned.
Sourcepub fn evaluate_provider_trust_for_hash(
&self,
provider: PublicKey,
hash: Hash,
now: u64,
) -> Result<ProviderTrustDecision>
pub fn evaluate_provider_trust_for_hash( &self, provider: PublicKey, hash: Hash, now: u64, ) -> Result<ProviderTrustDecision>
Evaluate a provider trust decision for a concrete content hash.
§Errors
Returns an error when the WoT state lock is poisoned.
Sourcepub fn provider_trust_records(
&self,
provider: PublicKey,
) -> Result<Vec<ProviderTrustRecord>>
pub fn provider_trust_records( &self, provider: PublicKey, ) -> Result<Vec<ProviderTrustRecord>>
Return all records for a provider, newest first.
§Errors
Returns an error when the WoT state lock is poisoned.
Sourcepub fn append_metadata(&self, entry: &MetadataEntry) -> Result<bool>
pub fn append_metadata(&self, entry: &MetadataEntry) -> Result<bool>
Append metadata after signature and local trust checks.
§Errors
Returns an error if the metadata is not signed, trusted, or the content has been self-revoked.
Sourcepub fn search_metadata(
&self,
query: &str,
limit: usize,
) -> Result<Vec<MetadataEntry>>
pub fn search_metadata( &self, query: &str, limit: usize, ) -> Result<Vec<MetadataEntry>>
Search trusted metadata while applying local revocation and moderation.
§Errors
Returns an error if the query or index is invalid.
Sourcepub fn revoke_self(&self, record: RevocationRecord) -> Result<bool>
pub fn revoke_self(&self, record: RevocationRecord) -> Result<bool>
Accept a publisher’s self-revocation.
§Errors
Returns an error if the signature is invalid or an older sequence was already recorded.
Sourcepub fn is_revoked(&self, content: &Hash) -> Result<bool>
pub fn is_revoked(&self, content: &Hash) -> Result<bool>
Return whether a content hash has a valid self-revocation.
§Errors
Returns an error if state is poisoned.
Sourcepub fn apply_moderation(&self, record: ModerationRecord) -> Result<bool>
pub fn apply_moderation(&self, record: ModerationRecord) -> Result<bool>
Accept a trusted moderation record.
§Errors
Returns an error if the signature is invalid, the moderator is not trusted, or an older sequence was already recorded.
Sourcepub fn moderation(&self, content: &Hash) -> Result<Option<ModerationRecord>>
pub fn moderation(&self, content: &Hash) -> Result<Option<ModerationRecord>>
Return the latest moderation record for a content hash.
§Errors
Returns an error if state is poisoned.
Sourcepub fn moderation_records(
&self,
content: &Hash,
) -> Result<Vec<ModerationRecord>>
pub fn moderation_records( &self, content: &Hash, ) -> Result<Vec<ModerationRecord>>
Return all moderation records for a content hash, newest first.
§Errors
Returns an error if state is poisoned.
Sourcepub fn list_moderation(
&self,
content: Option<&Hash>,
) -> Result<Vec<ModerationRecord>>
pub fn list_moderation( &self, content: Option<&Hash>, ) -> Result<Vec<ModerationRecord>>
List all moderation records, optionally restricted to one content hash.
§Errors
Returns an error if state is poisoned.
Sourcepub fn moderation_decision(
&self,
context: &ModerationContext,
) -> Result<ModerationAction>
pub fn moderation_decision( &self, context: &ModerationContext, ) -> Result<ModerationAction>
Evaluate the latest applicable moderation decision for a context.
More recent decisions win; when sequence numbers tie, the more specific scope wins.
§Errors
Returns an error if state is poisoned.
Sourcepub fn evaluate_moderation(
&self,
context: &ModerationContext,
) -> Result<ModerationAction>
pub fn evaluate_moderation( &self, context: &ModerationContext, ) -> Result<ModerationAction>
Sourcepub fn append_attestation(&self, attestation: Attestation) -> Result<bool>
pub fn append_attestation(&self, attestation: Attestation) -> Result<bool>
Store an attestation after cryptographic and local trust checks.
§Errors
Returns an error if the attestation is invalid or its issuer is not trusted.
Sourcepub fn verify_attestation(&self, attestation: &Attestation) -> Result<()>
pub fn verify_attestation(&self, attestation: &Attestation) -> Result<()>
Verify an attestation’s cryptographic signature without applying local trust policy.
§Errors
Returns an error if the attestation is malformed or tampered with.
Trait Implementations§
Source§impl Clone for WotService
impl Clone for WotService
Source§fn clone(&self) -> WotService
fn clone(&self) -> WotService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WotService
impl RefUnwindSafe for WotService
impl Send for WotService
impl Sync for WotService
impl Unpin for WotService
impl UnsafeUnpin for WotService
impl UnwindSafe for WotService
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