use std::fmt;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct ApiKey(String);
impl ApiKey {
pub fn new<S: Into<String>>(raw: S) -> Self {
Self(raw.into())
}
pub fn expose_secret(&self) -> &str {
&self.0
}
}
impl fmt::Debug for ApiKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ApiKey(***masked***)")
}
}
impl fmt::Display for ApiKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "***masked***")
}
}