pub enum AlgorithmKind {
HS256(Vec<u8>),
HS384(Vec<u8>),
HS512(Vec<u8>),
RS256 {
private_pem: Vec<u8>,
public_pem: Vec<u8>,
},
RS384 {
private_pem: Vec<u8>,
public_pem: Vec<u8>,
},
RS512 {
private_pem: Vec<u8>,
public_pem: Vec<u8>,
},
}Expand description
Supported JWT signing algorithms with their key material.
Variants§
HS256(Vec<u8>)
HMAC with SHA-256
HS384(Vec<u8>)
HMAC with SHA-384
HS512(Vec<u8>)
HMAC with SHA-512
RS256
RSA with SHA-256
RS384
RSA with SHA-384
RS512
RSA with SHA-512
Implementations§
Source§impl AlgorithmKind
impl AlgorithmKind
Sourcepub fn algorithm(&self) -> Algorithm
pub fn algorithm(&self) -> Algorithm
Returns the jsonwebtoken Algorithm enum variant for this algorithm.
Sourcepub fn from_rsa_files(
alg: Algorithm,
priv_key_file: &str,
pub_key_file: &str,
) -> Result<Self, JwtError>
pub fn from_rsa_files( alg: Algorithm, priv_key_file: &str, pub_key_file: &str, ) -> Result<Self, JwtError>
Creates an RSA algorithm variant by loading keys from files.
§Arguments
alg- The RSA algorithm to use (RS256, RS384, or RS512)priv_key_file- Path to the private key filepub_key_file- Path to the public key file
§Returns
Ok(AlgorithmKind)- The algorithm with loaded keysErr(JwtError)- If files cannot be read or keys are invalid
Trait Implementations§
Source§impl Clone for AlgorithmKind
impl Clone for AlgorithmKind
Source§fn clone(&self) -> AlgorithmKind
fn clone(&self) -> AlgorithmKind
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 AlgorithmKind
impl RefUnwindSafe for AlgorithmKind
impl Send for AlgorithmKind
impl Sync for AlgorithmKind
impl Unpin for AlgorithmKind
impl UnwindSafe for AlgorithmKind
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request