Skip to main content

DynProofVerifier

Trait DynProofVerifier 

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

Object-safe form of ProofVerifier used where a verifier must be stored behind a trait object — for example, on a transport binding’s shared state (Arc<dyn DynProofVerifier>) — so the concrete verifier type can be chosen at builder time rather than being threaded through every generic parameter.

ProofVerifier::verify is generic over the payload type P, which makes it not object-safe. DynProofVerifier erases that parameter by operating on the JSON-form document TrustTask<serde_json::Value>; both typed and untyped documents canonicalise to the same bytes for signature checking, so the erasure is lossless for verification.

Use erase_verifier to wrap any concrete ProofVerifier.

Required Methods§

Source

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

Verify doc.proof over the JSON-form document.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§