use std::sync::Arc;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum TlsExtensionError {
#[error("Unsupported certificate type")]
UnsupportedCertificateType,
#[error("Extension encoding error: {0}")]
EncodingError(String),
#[error("Extension decoding error: {0}")]
DecodingError(String),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CertificateType {
X509 = 0,
RawPublicKey = 2,
}
pub struct CertificateTypeHandler {
supported_types: Vec<CertificateType>,
}
impl CertificateTypeHandler {
pub fn new(supported_types: Vec<CertificateType>) -> Self {
Self { supported_types }
}
pub fn raw_public_key_only() -> Self {
Self {
supported_types: vec![CertificateType::RawPublicKey],
}
}
pub fn supported_types(&self) -> &[CertificateType] {
&self.supported_types
}
}