diff --git a/crates/rpc/rpc/src/layers/auth_layer.rs b/crates/rpc/rpc/src/layers/auth_layer.rs index be49324391..c71c8f99dd 100644 --- a/crates/rpc/rpc/src/layers/auth_layer.rs +++ b/crates/rpc/rpc/src/layers/auth_layer.rs @@ -1,3 +1,4 @@ +use super::AuthValidator; use http::{Request, Response}; use http_body::Body; use pin_project::pin_project; @@ -8,8 +9,6 @@ use std::{ }; use tower::{Layer, Service}; -use super::AuthValidator; - /// This is an Http middleware layer that acts as an /// interceptor for `Authorization` headers. Incoming requests are dispatched to /// an inner [`AuthValidator`]. Invalid requests are blocked and the validator's error response is diff --git a/crates/rpc/rpc/src/layers/jwt_secret.rs b/crates/rpc/rpc/src/layers/jwt_secret.rs index dd825c9142..9a34917483 100644 --- a/crates/rpc/rpc/src/layers/jwt_secret.rs +++ b/crates/rpc/rpc/src/layers/jwt_secret.rs @@ -3,13 +3,10 @@ use jsonwebtoken::{decode, errors::ErrorKind, Algorithm, DecodingKey, Validation use rand::Rng; use serde::{Deserialize, Serialize}; use std::{ - collections::hash_map::DefaultHasher, - hash::{Hash, Hasher}, path::Path, time::{Duration, SystemTime, UNIX_EPOCH}, }; use thiserror::Error; -use tracing::info; /// Errors returned by the [`JwtSecret`][crate::layers::JwtSecret] #[derive(Error, Debug)] @@ -46,7 +43,7 @@ const JWT_MAX_IAT_DIFF: Duration = Duration::from_secs(60); /// The execution layer client MUST support at least the following alg HMAC + SHA256 (HS256) const JWT_SIGNATURE_ALGO: Algorithm = Algorithm::HS256; -/// Value-object holding a reference to an hex-encoded 256-bit secret key. +/// Value-object holding a reference to a hex-encoded 256-bit secret key. /// A JWT secret key is used to secure JWT-based authentication. The secret key is /// a shared secret between the server and the client and is used to calculate a digital signature /// for the JWT, which is included in the JWT along with its payload. @@ -79,7 +76,6 @@ impl JwtSecret { pub fn from_file(fpath: &Path) -> Result { let hex = std::fs::read_to_string(fpath)?; let secret = JwtSecret::from_hex(hex)?; - info!("Loaded secret {secret:?} from {fpath:?}"); Ok(secret) } @@ -95,18 +91,13 @@ impl JwtSecret { let bytes = &secret.0; let hex = hex::encode(bytes); std::fs::write(fpath, hex)?; - info!("Created ephemeral secret {secret:?} at {fpath:?}"); Ok(secret) } } impl std::fmt::Debug for JwtSecret { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let mut hasher = DefaultHasher::new(); - let bytes = &self.0; - bytes.hash(&mut hasher); - let hash = format!("{}", hasher.finish()); - f.debug_tuple("JwtSecretHash").field(&hex::encode(hash)).finish() + f.debug_tuple("JwtSecretHash").field(&"{{}}").finish() } } @@ -322,7 +313,6 @@ mod tests { } Err(_) => { delete(fpath); - assert!(false); // Fail test } } } @@ -345,7 +335,7 @@ mod tests { } fn hex(secret: &JwtSecret) -> String { - hex::encode(&secret.0) + hex::encode(secret.0) } fn delete(path: &Path) {