diff --git a/daemon/src/auth.rs b/daemon/src/auth.rs index 3dca757..1689d99 100644 --- a/daemon/src/auth.rs +++ b/daemon/src/auth.rs @@ -10,6 +10,8 @@ use std::str::FromStr; /// A request guard that can be included in handler definitions to enforce authentication. pub struct Authenticated {} +pub const MAKER_USERNAME: &str = "maker"; + #[derive(Debug)] pub enum Error { UnknownUser(String), @@ -62,7 +64,7 @@ impl<'r> FromRequest<'r> for Authenticated { .await .map_failure(|(status, _)| (status, Error::MissingPassword))); - if basic_auth.username != "maker" { + if basic_auth.username != MAKER_USERNAME { return Outcome::Failure(( Status::Unauthorized, Error::UnknownUser(basic_auth.username), diff --git a/daemon/src/maker.rs b/daemon/src/maker.rs index 286cbf5..9b06ebf 100644 --- a/daemon/src/maker.rs +++ b/daemon/src/maker.rs @@ -1,3 +1,4 @@ +use crate::auth::MAKER_USERNAME; use crate::maker_cfd_actor::Command; use crate::seed::Seed; use crate::wallet::Wallet; @@ -89,7 +90,11 @@ async fn main() -> Result<()> { let auth_password = seed.derive_auth_password::(); - println!("Auth password: {}", auth_password); + tracing::info!( + "Authentication details: username='{}' password='{}'", + MAKER_USERNAME, + auth_password + ); let oracle = schnorrsig::KeyPair::new(SECP256K1, &mut rand::thread_rng()); // TODO: Fetch oracle public key from oracle.