Struct jsonwebtoken::DecodingKey
source · pub struct DecodingKey<'a> { /* 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<'a> DecodingKey<'a>
impl<'a> DecodingKey<'a>
sourcepub fn from_secret(secret: &'a [u8]) -> Self
pub fn from_secret(secret: &'a [u8]) -> Self
If you’re using HMAC, use this.
sourcepub fn from_base64_secret(secret: &str) -> Result<Self>
pub fn from_base64_secret(secret: &str) -> Result<Self>
If you’re using HMAC with a base64 encoded, use this.
sourcepub fn from_rsa_pem(key: &'a [u8]) -> Result<Self>
pub fn from_rsa_pem(key: &'a [u8]) -> Result<Self>
If you are loading a public RSA key in a PEM format, use this.
sourcepub fn from_rsa_components(modulus: &'a str, exponent: &'a str) -> Self
pub fn from_rsa_components(modulus: &'a str, exponent: &'a str) -> Self
If you have (n, e) RSA public key components, use this.
sourcepub fn from_ec_pem(key: &'a [u8]) -> Result<Self>
pub fn from_ec_pem(key: &'a [u8]) -> Result<Self>
If you have a ECDSA public key in PEM format, use this.
sourcepub fn from_rsa_der(der: &'a [u8]) -> Self
pub fn from_rsa_der(der: &'a [u8]) -> Self
If you know what you’re doing and have a RSA DER encoded public key, use this.
sourcepub fn from_ec_der(der: &'a [u8]) -> Self
pub fn from_ec_der(der: &'a [u8]) -> Self
If you know what you’re doing and have a RSA EC encoded public key, use this.
sourcepub fn into_static(self) -> DecodingKey<'static>
pub fn into_static(self) -> DecodingKey<'static>
Convert self to DecodingKey<'static>
.
Trait Implementations§
source§impl<'a> Clone for DecodingKey<'a>
impl<'a> Clone for DecodingKey<'a>
source§fn clone(&self) -> DecodingKey<'a>
fn clone(&self) -> DecodingKey<'a>
Returns a copy 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 moresource§impl<'a> Debug for DecodingKey<'a>
impl<'a> Debug for DecodingKey<'a>
source§impl<'a> PartialEq for DecodingKey<'a>
impl<'a> PartialEq for DecodingKey<'a>
source§fn eq(&self, other: &DecodingKey<'a>) -> bool
fn eq(&self, other: &DecodingKey<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> StructuralPartialEq for DecodingKey<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for DecodingKey<'a>
impl<'a> Send for DecodingKey<'a>
impl<'a> Sync for DecodingKey<'a>
impl<'a> Unpin for DecodingKey<'a>
impl<'a> UnwindSafe for DecodingKey<'a>
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