Skip to main content

MultiKeyVerifier

Struct MultiKeyVerifier 

Source
pub struct MultiKeyVerifier { /* private fields */ }
Expand description

A JwsVerifier that holds multiple keys and applies RFC 7517 key selection semantics.

Key selection follows KeyMatchStrength priority:

For a JWKS-backed verifier with automatic refresh and retry wrapped around this type, use JwksSource; construct MultiKeyVerifier directly only for a custom stack.

Implementations§

Source§

impl MultiKeyVerifier

Source

pub fn new(verifiers: Vec<Arc<dyn JwsVerifier>>) -> Self

Creates a MultiKeyVerifier from an explicit list of verifiers.

Source

pub async fn from_jwks( jwks: &PublicJwks, platform: &dyn JwsVerifierPlatform, ) -> Result<Self, Error>

Builds a MultiKeyVerifier from a JWKS document.

Keys with unsupported algorithms are silently skipped.

This is a general-purpose constructor with no key-count limit: it may be fed from a trusted source (a KMS, an enclave, a local file) as well as a remote JWKS. Bounding the key count of an untrusted, remotely-fetched document is the fetcher’s job — see JwksSource.

§Errors

Returns ErrorKind::Crypto if a supported key fails to construct a verifier.

Source

pub fn try_all_on_ambiguous_match(self, value: bool) -> Self

Configures whether to try all matching keys when no kid is present and multiple keys match by algorithm.

When false (the default), multiple algorithm matches without a kid return AmbiguousKeyMatch. When true, each candidate is tried in order and the first success is accepted.

Trait Implementations§

Source§

impl Debug for MultiKeyVerifier

Source§

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

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

impl JwsVerifier for MultiKeyVerifier

Source§

fn key_match(&self, key_match: &KeyMatch<'_>) -> Option<KeyMatchStrength>

Returns how well this verifier matches the given key selection criteria. Read more
Source§

fn verify<'a>( &'a self, input: &'a [u8], signature: &'a [u8], key_match: &'a KeyMatch<'a>, ) -> MaybeSendBoxFuture<'a, Result<(), VerifyError>>

Verify the input against the provided signature.
Source§

fn try_refresh(&self) -> MaybeSendBoxFuture<'_, bool>

Requests a best-effort refresh of the verifier’s key material. Read more

Auto Trait Implementations§

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<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.