Enum mas_jose::jwa::SymmetricKey
source · #[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 UnwindSafe for SymmetricKey
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> 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 more