use alloc::string::String;
use serde::{Deserialize, Serialize};
use super::{Private, Public, Thumbprint};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[serde(untagged)]
pub enum AsymmetricJsonWebKey {
Private(Private),
Public(Public),
}
impl crate::sealed::Sealed for AsymmetricJsonWebKey {}
impl Thumbprint for AsymmetricJsonWebKey {
fn thumbprint_prehashed(&self) -> String {
match self {
AsymmetricJsonWebKey::Private(key) => key.thumbprint_prehashed(),
AsymmetricJsonWebKey::Public(key) => key.thumbprint_prehashed(),
}
}
}
impl From<AsymmetricJsonWebKey> for super::JsonWebKeyType {
fn from(x: AsymmetricJsonWebKey) -> Self {
super::JsonWebKeyType::Asymmetric(alloc::boxed::Box::new(x))
}
}