eln_plugin_sdk/
api_key.rs1use std::fmt;
6
7#[derive(Clone, PartialEq, Eq, Hash)]
8pub struct ApiKey(String);
9
10impl ApiKey {
11 pub fn new<S: Into<String>>(raw: S) -> Self {
12 Self(raw.into())
13 }
14
15 pub fn expose_secret(&self) -> &str {
17 &self.0
18 }
19}
20
21impl fmt::Debug for ApiKey {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 write!(f, "ApiKey(***masked***)")
24 }
25}
26
27impl fmt::Display for ApiKey {
28 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 write!(f, "***masked***")
30 }
31}