pub struct CryptoProvider {
pub signer_factory: fn(&Algorithm, &EncodingKey) -> Result<Box<dyn JwtSigner>>,
pub verifier_factory: fn(&Algorithm, &DecodingKey) -> Result<Box<dyn JwtVerifier>>,
pub jwk_utils: JwkUtils,
}Expand description
Controls the cryptography used by jsonwebtoken.
You can either install one of the built-in options:
- [
crypto::aws_lc::DEFAULT_PROVIDER]: (behind theaws_lc_rscrate feature). This provider uses the aws-lc-rs crate. - [
crypto::rust_crypto::DEFAULT_PROVIDER]: (behind therust_cryptocrate feature) This provider uses crates from the Rust Crypto project.
or provide your own custom custom implementation of CryptoProvider.
Fields§
§signer_factory: fn(&Algorithm, &EncodingKey) -> Result<Box<dyn JwtSigner>>§verifier_factory: fn(&Algorithm, &DecodingKey) -> Result<Box<dyn JwtVerifier>>A function that produces a JwtVerifier for a given Algorithm
jwk_utils: JwkUtilsStruct with utility functions for JWK processing.
Implementations§
Source§impl CryptoProvider
impl CryptoProvider
Sourcepub fn install_default(&'static self) -> Result<(), &'static Self>
pub fn install_default(&'static self) -> Result<(), &'static Self>
Set this CryptoProvider as the default for this process.
This can be called successfully at most once in any process execution.
Trait Implementations§
Source§impl Clone for CryptoProvider
impl Clone for CryptoProvider
Source§fn clone(&self) -> CryptoProvider
fn clone(&self) -> CryptoProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CryptoProvider
impl RefUnwindSafe for CryptoProvider
impl Send for CryptoProvider
impl Sync for CryptoProvider
impl Unpin for CryptoProvider
impl UnwindSafe for CryptoProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more