Skip to main content

ProviderSession

Struct ProviderSession 

Source
pub struct ProviderSession<P> { /* private fields */ }
Expand description

One explicitly selected backend session with stable nonzero-sized ownership.

This owns the adapter, not a global registry or cryptographic engine. A borrowed adapter may itself hold the caller’s existing engine/policy. Its address remains stable while finalized outputs or challenges borrow it. Distinct selections remain distinct even for zero-sized stateless adapters. There is no implicit Clone, allocation or synchronization requirement.

Implementations§

Source§

impl<P> ProviderSession<P>

Source

pub const fn new(backend: P) -> Self

Creates a distinct selection owner before resolving any document input.

Source

pub const fn backend(&self) -> &P

The selected adapter; this accessor does not transfer session provenance.

Source

pub fn same_session(&self, other: &Self) -> bool

Identity of the live selection owner, even when both adapters are ZSTs.

Trait Implementations§

Source§

impl<'a, P: AsnDigest<'a>> AsnDigest<'a> for ProviderSession<P>

Source§

fn identity(&self, algorithm: Algorithm) -> Option<Self::Identity>

This provider’s identity for algorithm, or None when it does not implement it or its policy refuses it. O(1); no work is spent.
Source§

impl<P: Debug> Debug for ProviderSession<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Deref for ProviderSession<P>

Source§

type Target = P

The resulting type after dereferencing.
Source§

fn deref(&self) -> &P

Dereferences the value.
Source§

impl<'a, P: Digest<'a>> Digest<'a> for ProviderSession<P>

Source§

type Identity = <P as Digest<'a>>::Identity

Fully resolved digest identity.
Source§

type State = <P as Digest<'a>>::State

Digest state, independently movable from its identity object.
Source§

type Output = <P as Digest<'a>>::Output

Final output, inline or retaining its own admitted allocation charge.
Source§

type Error = <P as Digest<'a>>::Error

Original callback failure, including that provider’s resource refusal.
Source§

fn width(&self, identity: &Self::Identity) -> Option<usize>

Fixed output width, or None for an identity without one. This is O(1) metadata access on the resolved identity, not parsing.
Source§

fn compare<W: Work>( &self, left: &Self::Identity, right: &Self::Identity, work: &W, ) -> Result<Ordering, Self::Error>

Total semantic order: Equal means the outputs can be shared.
Source§

fn start<W: Work>( &'a self, identity: &Self::Identity, work: &W, ) -> Result<Resolution<Self::State>, Self::Error>

Starts one stream for this identity without retaining a reference to the identity object. A backend without incremental capability answers Unsupported; it never buffers into a one-shot fallback.
Source§

fn update<W: Work>( &self, state: &mut Self::State, bytes: &[u8], work: &W, ) -> Result<(), Self::Error>

Admits and processes one complete chunk exactly once.
Source§

fn finish<W: Work>( &self, state: Self::State, work: &W, ) -> Result<Self::Output, Self::Error>

Consumes a completed state once; no state cloning or repeated finish.
Source§

fn matches<W: Work>( &self, identity: &Self::Identity, output: &Self::Output, expected: &[u8], work: &W, ) -> Result<bool, Self::Error>

Compares this provider’s finished output with declared bytes, admitting the whole scan and applying the backend’s comparison strategy. Read more
Source§

impl<'a, P: SignatureProvider<'a>> SignatureProvider<'a> for ProviderSession<P>

Source§

type SignatureIdentity = <P as SignatureProvider<'a>>::SignatureIdentity

Fully resolved signature identity, including algorithm-specific defaults.
Source§

type RawState = <P as SignatureProvider<'a>>::RawState

Raw verification state, initialized with original signature/key first.
Source§

fn resolve_signature( &'a self, algorithm: AlgorithmIdentifier<'a>, digest: &Self::Identity, key: WorkingKey<'a>, encoding: Encoding, parent: &Reader<'a>, ) -> Result<Resolution<SignatureMode<Self::SignatureIdentity>>, Self::Error>

Chooses raw versus prehashed only after complete algorithm/key resolution.
Source§

fn compare_signature<W: Work>( &self, left: &Self::SignatureIdentity, right: &Self::SignatureIdentity, work: &W, ) -> Result<Ordering, Self::Error>

Semantic signature/default comparison for protected versus outer identifiers.
Source§

fn start_raw<W: Work>( &'a self, identity: &Self::SignatureIdentity, key: WorkingKey<'a>, signature: &'a Octets<'a>, work: &W, ) -> Result<Self::RawState, Self::Error>

Starts the raw challenge with the original signature and effective key.
Source§

fn update_raw<W: Work>( &self, state: &mut Self::RawState, bytes: &[u8], work: &W, ) -> Result<(), Self::Error>

Admits and processes original raw message chunks, never digest bytes.
Source§

fn finish_raw<W: Work>( &self, state: Self::RawState, work: &W, ) -> Result<SignatureAnswer, Self::Error>

Completes a raw signature only after successful complete source EOF.
Source§

fn verify_prehashed<W: Work>( &'a self, identity: &Self::SignatureIdentity, key: WorkingKey<'a>, signature: &Octets<'a>, digest: Prehash<'_, '_, Self, Self::Identity>, work: &W, ) -> Result<SignatureAnswer, Self::Error>

Verifies one borrowed finalized digest with its full identity; no rehash.

Auto Trait Implementations§

§

impl<P> Freeze for ProviderSession<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for ProviderSession<P>
where P: RefUnwindSafe,

§

impl<P> Send for ProviderSession<P>
where P: Send,

§

impl<P> Sync for ProviderSession<P>
where P: Sync,

§

impl<P> Unpin for ProviderSession<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for ProviderSession<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for ProviderSession<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.