use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum Algorithm {
HS256,
HS384,
HS512,
RS256,
RS384,
RS512,
ES256,
ES384,
ES512,
PS256,
PS384,
PS512,
None,
}
#[allow(clippy::len_without_is_empty)]
impl Algorithm {
pub fn len(&self) -> usize {
match self {
Self::HS256 | Self::RS256 | Self::ES256 | Self::PS256 => 32,
Self::HS384 | Self::RS384 | Self::ES384 | Self::PS384 => 48,
Self::HS512 | Self::RS512 | Self::ES512 | Self::PS512 => 64,
_ => 0,
}
}
}