about summary refs log tree commit diff
path: root/src/login.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2025-01-01 05:42:45 +0300
committerVika <vika@fireburn.ru>2025-01-01 07:08:33 +0300
commit5ad8443c8d6d9ed3f9d28ac52af529ceb41d741f (patch)
tree5d6dd326abd9cd135652e68fc893c2a95486a798 /src/login.rs
parentdf509eadc9aecef605194b7c97c5fb02bf928b79 (diff)
downloadkittybox-5ad8443c8d6d9ed3f9d28ac52af529ceb41d741f.tar.zst
Get rid of base64 and hex in favor of data_encoding crate
Less dependency duplication = more fun

Change-Id: Icbd0497a68fdd5bea3757e3c62c80008b87bce96
Diffstat (limited to 'src/login.rs')
-rw-r--r--src/login.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/login.rs b/src/login.rs
index 646c832..19bfaf7 100644
--- a/src/login.rs
+++ b/src/login.rs
@@ -332,7 +332,13 @@ async fn client_metadata<S: Storage + Send + Sync + 'static>(
         digest.update(b" ");
         digest.update(crate::OAUTH2_SOFTWARE_ID.as_bytes());
 
-        let etag = String::from("W/") + &hex::encode(digest.finalize());
+        let etag = {
+            let mut etag = String::with_capacity(66);
+            etag.push_str("W/");
+            data_encoding::HEXLOWER.encode_append(&digest.finalize(), &mut etag);
+
+            etag
+        };
         axum_extra::headers::ETag::from_str(&etag).unwrap()
     };
     if let Some(cached) = cached {