2024-05-11 19:46:20 +01:00
|
|
|
/// The API Token for the [user]
|
|
|
|
/// ForgeJo: https://{hostname}/user/settings/applications
|
|
|
|
/// Github: https://github.com/settings/tokens
|
2024-05-15 07:55:05 +01:00
|
|
|
#[derive(Clone, Debug, derive_more::Constructor)]
|
|
|
|
pub struct ApiToken(secrecy::Secret<String>);
|
2024-05-11 19:46:20 +01:00
|
|
|
/// The API Token is in effect a password, so it must be explicitly exposed to access its value
|
|
|
|
impl secrecy::ExposeSecret<String> for ApiToken {
|
|
|
|
fn expose_secret(&self) -> &String {
|
|
|
|
self.0.expose_secret()
|
|
|
|
}
|
|
|
|
}
|
2024-05-19 20:02:06 +01:00
|
|
|
impl Default for ApiToken {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self("".to_string().into())
|
|
|
|
}
|
|
|
|
}
|