pub struct DecodingKey { /* private fields */ }Expand description
All the different kind of keys we can use to decode a JWT. This key can be re-used so make sure you only initialize it once if you can for better performance.
Implementations§
Source§impl DecodingKey
impl DecodingKey
Sourcepub fn from_secret(secret: &[u8]) -> DecodingKey
pub fn from_secret(secret: &[u8]) -> DecodingKey
If you’re using HMAC, use this.
Sourcepub fn from_base64_secret(secret: &str) -> Result<DecodingKey, Error>
pub fn from_base64_secret(secret: &str) -> Result<DecodingKey, Error>
If you’re using HMAC with a base64 encoded secret, use this.
Sourcepub fn from_rsa_pem(key: &[u8]) -> Result<DecodingKey, Error>
pub fn from_rsa_pem(key: &[u8]) -> Result<DecodingKey, Error>
If you are loading a public RSA key in a PEM format, use this.
Only exists if the feature use_pem is enabled.
Sourcepub fn from_rsa_components(
modulus: &str,
exponent: &str,
) -> Result<DecodingKey, Error>
pub fn from_rsa_components( modulus: &str, exponent: &str, ) -> Result<DecodingKey, Error>
If you have (n, e) RSA public key components as strings, use this.
Sourcepub fn from_rsa_raw_components(modulus: &[u8], exponent: &[u8]) -> DecodingKey
pub fn from_rsa_raw_components(modulus: &[u8], exponent: &[u8]) -> DecodingKey
If you have (n, e) RSA public key components already decoded, use this.
Sourcepub fn from_ec_pem(key: &[u8]) -> Result<DecodingKey, Error>
pub fn from_ec_pem(key: &[u8]) -> Result<DecodingKey, Error>
If you have a ECDSA public key in PEM format, use this.
Only exists if the feature use_pem is enabled.
Sourcepub fn from_ec_components(x: &str, y: &str) -> Result<DecodingKey, Error>
pub fn from_ec_components(x: &str, y: &str) -> Result<DecodingKey, Error>
If you have (x,y) ECDSA key components
Sourcepub fn from_ed_pem(key: &[u8]) -> Result<DecodingKey, Error>
pub fn from_ed_pem(key: &[u8]) -> Result<DecodingKey, Error>
If you have a EdDSA public key in PEM format, use this.
Only exists if the feature use_pem is enabled.
Sourcepub fn from_rsa_der(der: &[u8]) -> DecodingKey
pub fn from_rsa_der(der: &[u8]) -> DecodingKey
If you know what you’re doing and have a RSA DER encoded public key, use this.
Sourcepub fn from_ec_der(der: &[u8]) -> DecodingKey
pub fn from_ec_der(der: &[u8]) -> DecodingKey
If you know what you’re doing and have a RSA EC encoded public key, use this.
Sourcepub fn from_ed_der(der: &[u8]) -> DecodingKey
pub fn from_ed_der(der: &[u8]) -> DecodingKey
If you know what you’re doing and have a Ed DER encoded public key, use this.
Sourcepub fn from_ed_components(x: &str) -> Result<DecodingKey, Error>
pub fn from_ed_components(x: &str) -> Result<DecodingKey, Error>
From x part (base64 encoded) of the JWK encoding
Trait Implementations§
Source§impl Clone for DecodingKey
impl Clone for DecodingKey
Source§fn clone(&self) -> DecodingKey
fn clone(&self) -> DecodingKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl TokenValidator for DecodingKey
impl TokenValidator for DecodingKey
fn validate_token<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<SpacetimeIdentityClaims, TokenValidationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for DecodingKey
impl RefUnwindSafe for DecodingKey
impl Send for DecodingKey
impl Sync for DecodingKey
impl Unpin for DecodingKey
impl UnwindSafe for DecodingKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more