about summary refs log tree commit diff
path: root/kittybox-rs/src
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r--kittybox-rs/src/indieauth/backend/fs.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/kittybox-rs/src/indieauth/backend/fs.rs b/kittybox-rs/src/indieauth/backend/fs.rs
index 57bc3bd..600e901 100644
--- a/kittybox-rs/src/indieauth/backend/fs.rs
+++ b/kittybox-rs/src/indieauth/backend/fs.rs
@@ -14,7 +14,7 @@ const CODE_LENGTH: usize = 16;
 const TOKEN_LENGTH: usize = 128;
 const CODE_DURATION: std::time::Duration = std::time::Duration::from_secs(600);
 
-#[derive(Clone)]
+#[derive(Clone, Debug)]
 pub struct FileBackend {
     path: PathBuf,
 }
@@ -302,6 +302,7 @@ impl AuthBackend for FileBackend {
     }
 
     // Password management.
+    #[tracing::instrument(skip(password))]
     async fn verify_password(&self, website: &url::Url, password: String) -> Result<bool> {
         use argon2::{Argon2, password_hash::{PasswordHash, PasswordVerifier}};
 
@@ -309,6 +310,8 @@ impl AuthBackend for FileBackend {
             .join(FileBackend::url_to_dir(website))
             .join("password");
 
+        tracing::debug!("Reading password for {} from {}", website, password_filename.display());
+
         match tokio::fs::read_to_string(password_filename).await {
             Ok(password_hash) => {
                 let parsed_hash = {
@@ -327,6 +330,7 @@ impl AuthBackend for FileBackend {
         }
     }
 
+    #[tracing::instrument(skip(password))]
     async fn enroll_password(&self, website: &url::Url, password: String) -> Result<()> {
         use argon2::{Argon2, password_hash::{rand_core::OsRng, PasswordHasher, SaltString}};
 
@@ -340,6 +344,7 @@ impl AuthBackend for FileBackend {
             .expect("Hashing a password should not error out")
             .to_string();
 
+        tracing::debug!("Enrolling password for {} at {}", website, password_filename.display());
         tokio::fs::write(password_filename, password_hash.as_bytes()).await
     }