Skip to main content

Provider

Trait Provider 

Source
pub trait Provider:
    Clone
    + Send
    + Sync
    + 'static {
    type Scope: Clone + Send + Sync + 'static;
    type Scheme: Scheme;

    // Required method
    fn scoped(&self, scope: Self::Scope) -> Option<Scoped<Self::Scheme>>;

    // Provided method
    fn scheme(&self, scope: Self::Scope) -> Option<Arc<Self::Scheme>> { ... }
}
Expand description

Supplies the signing scheme for a given scope.

This trait uses an associated Scope type, allowing implementations to work with any scope representation (e.g., epoch numbers, block heights, etc.).

Required Associated Types§

Source

type Scope: Clone + Send + Sync + 'static

The scope type used to look up schemes.

Source

type Scheme: Scheme

The signing scheme to provide.

Required Methods§

Source

fn scoped(&self, scope: Self::Scope) -> Option<Scoped<Self::Scheme>>

Return a Scoped for scope capable of verifying certificates produced under it.

A scheme that can verify certificates from any scope without scope-specific state should return a verify-only Scoped (via Scoped::verifier) for every scope. A fixed group public key that survives committee rotation is one such case. A scheme that needs scope-specific verification state should return None once that state is unavailable.

Provided Methods§

Source

fn scheme(&self, scope: Self::Scope) -> Option<Arc<Self::Scheme>>

Return the full signing scheme that corresponds to scope, if available.

The default returns a scheme only when Provider::scoped yields a signing scope, so a verify-only scope produces None. Override this when the signing scheme is available even for scopes that Provider::scoped serves with a verify-only result.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<S: Scheme, Sc: Clone + Send + Sync + 'static> Provider for ConstantProvider<S, Sc>

Source§

type Scope = Sc

Source§

type Scheme = S