Skip to main content

ProofVerifier

Trait ProofVerifier 

Source
pub trait ProofVerifier: Send + Sync {
    // Required method
    fn verify<'life0, 'life1, 'async_trait, P>(
        &'life0 self,
        doc: &'life1 TrustTask<P>,
    ) -> Pin<Box<dyn Future<Output = Result<(), VerificationError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             P: Serialize + Send + Sync + 'async_trait,
             Self: 'async_trait;
}
Expand description

Plug-in seam for verifying a Trust Task document’s proof member.

This crate intentionally implements no cryptosuites; verification lives in companion crates (e.g. trust-tasks-proof with its affinidi feature for the Affinidi Data Integrity stack). Consumer pipelines pick a verifier and invoke it as part of their §7.2 validation step, alongside crate::TrustTask::validate_basic.

The trait is async — most verifiers need to resolve a verificationMethod URI to verification material, which is naturally I/O (DID resolution, JWKS fetch, …). Implementations that hold all keys locally can simply async-no-op around their sync path.

A verifier MUST:

  • Confirm the proof’s cryptosuite matches an algorithm it implements; reject otherwise with VerificationError::UnsupportedCryptosuite.
  • Resolve verificationMethod to verification material controlled by the document’s in-band issuer (SPEC.md §4.7, §4.8 paragraph 1).
  • Validate the signature over the document with proof excluded per the chosen Data Integrity suite’s canonicalisation rules.

Required Methods§

Source

fn verify<'life0, 'life1, 'async_trait, P>( &'life0 self, doc: &'life1 TrustTask<P>, ) -> Pin<Box<dyn Future<Output = Result<(), VerificationError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, P: Serialize + Send + Sync + 'async_trait, Self: 'async_trait,

Verify doc.proof against doc’s content and doc.issuer.

Returns Ok(()) when the proof is valid. Implementations should match the spec’s failure-mode taxonomy — see VerificationError variants — so the consumer pipeline can map to the right crate::StandardCode in its outbound trust-task-error response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ProofVerifier for Verifier

Source§

fn verify<'life0, 'life1, 'async_trait, P>( &'life0 self, doc: &'life1 TrustTask<P>, ) -> Pin<Box<dyn Future<Output = Result<(), VerificationError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, P: Serialize + Send + Sync + 'async_trait, Verifier: 'async_trait,

Implementors§