identity_jose/jwk/
key_type.rs1use core::fmt::Display;
5use core::fmt::Formatter;
6use core::fmt::Result;
7
8#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, serde::Deserialize, serde::Serialize)]
12pub enum JwkType {
13 #[serde(rename = "EC")]
15 Ec,
16 #[serde(rename = "RSA")]
18 Rsa,
19 #[serde(rename = "oct")]
21 Oct,
22 #[serde(rename = "OKP")]
24 Okp,
25}
26
27impl JwkType {
28 pub const fn name(self) -> &'static str {
30 match self {
31 Self::Ec => "EC",
32 Self::Rsa => "RSA",
33 Self::Oct => "oct",
34 Self::Okp => "OKP",
35 }
36 }
37}
38
39impl Display for JwkType {
40 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
41 f.write_str(self.name())
42 }
43}