#![cfg(feature = "native-tls")]
use std::{borrow::Cow, path::Path};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ClientIdentity {
pkcs12_path: Cow<'static, Path>,
password: Option<Cow<'static, str>>,
}
impl ClientIdentity {
pub fn new<T>(pkcs12_path: T) -> Self
where
T: Into<Cow<'static, Path>>,
{
Self {
pkcs12_path: pkcs12_path.into(),
password: None,
}
}
pub fn with_password<T>(mut self, pass: T) -> Self
where
T: Into<Cow<'static, str>>,
{
self.password = Some(pass.into());
self
}
pub fn pkcs12_path(&self) -> &Path {
self.pkcs12_path.as_ref()
}
pub fn password(&self) -> Option<&str> {
self.password.as_ref().map(AsRef::as_ref)
}
}