use std::{
any::type_name,
fmt::{Debug, Display},
};
use zeroize::ZeroizeOnDrop;
#[derive(Debug, Clone)]
pub struct ClientId(String);
impl ClientId {
pub fn new(id: String) -> Self {
Self(id)
}
pub fn into_string(self) -> String {
self.0
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Display for ClientId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
#[derive(Clone, ZeroizeOnDrop)]
pub struct ClientSecret(String);
impl ClientSecret {
pub fn new(client_secret: String) -> Self {
Self(client_secret)
}
pub(crate) fn as_str(&self) -> &str {
self.0.as_str()
}
}
impl Debug for ClientSecret {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple(type_name::<Self>())
.field(&"**********")
.finish()
}
}