#[non_exhaustive]pub enum SymmetricKey {
Hs256(Hs256Key),
Hs384(Hs384Key),
Hs512(Hs512Key),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl SymmetricKey
impl SymmetricKey
Sourcepub fn new_for_alg(
key: Vec<u8>,
alg: &JsonWebSignatureAlg,
) -> Result<Self, InvalidAlgorithm>
pub fn new_for_alg( key: Vec<u8>, alg: &JsonWebSignatureAlg, ) -> Result<Self, InvalidAlgorithm>
Create a new symmetric key for the given algorithm with the given key.
§Errors
Returns an error if the algorithm is not supported.
Sourcepub const fn hs256(key: Vec<u8>) -> Self
pub const fn hs256(key: Vec<u8>) -> Self
Create a new symmetric key using the HS256 algorithm with the given key.
Auto Trait Implementations§
impl Freeze for SymmetricKey
impl RefUnwindSafe for SymmetricKey
impl Send for SymmetricKey
impl Sync for SymmetricKey
impl Unpin for SymmetricKey
impl UnsafeUnpin for SymmetricKey
impl UnwindSafe for SymmetricKey
Blanket Implementations§
Source§impl<S, T> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
impl<S, T> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
Source§async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
Attempt to sign the given message, returning a digital signature on success, or an error if
something went wrong. Read more
Source§impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
Source§impl<S, T> AsyncVerifier<S> for Twhere
T: Verifier<S>,
impl<S, T> AsyncVerifier<S> for Twhere
T: Verifier<S>,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
Converts
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>
Converts
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 moreSource§impl<S, T> RandomizedSignerMut<S> for Twhere
T: RandomizedSigner<S>,
impl<S, T> RandomizedSignerMut<S> for Twhere
T: RandomizedSigner<S>,
Source§fn try_sign_with_rng<R>(&mut self, rng: &mut R, msg: &[u8]) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
fn try_sign_with_rng<R>(&mut self, rng: &mut R, msg: &[u8]) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
Attempt to sign the given message, updating the state, and returning a digital signature on
success, or an error if something went wrong. Read more