diff --git a/src/api/extract.rs b/src/api/extract.rs index 333bc31..4b9ef79 100644 --- a/src/api/extract.rs +++ b/src/api/extract.rs @@ -3,7 +3,7 @@ use axum::{ async_trait, body::BoxBody, extract::FromRequest, http::Request, response::IntoResponse, }; use ssh_key::{Certificate, SshSig}; - +use tracing::trace; use super::ApiError; #[derive(Debug, Clone)] @@ -20,12 +20,11 @@ where async fn from_request(req: Request, state: &S) -> Result { let body = String::from_request(req, state) .await - .map_err(|err| err.into_response()) - .unwrap(); //.context("failed to extract body")?; + .context("failed to extract body")?; let cert = Certificate::from_openssh(&body) .with_context(|| format!("failed to parse '{}'", body))?; - + trace!(%body, "extracted certificate"); Ok(Self(cert)) } } @@ -43,11 +42,10 @@ where async fn from_request(req: Request, state: &S) -> Result { let body = String::from_request(req, state) .await - .map_err(|err| err.into_response()) - .unwrap(); //.context("failed to extract body")?; + .context("failed to extract body")?; let sig = SshSig::from_pem(&body).with_context(|| format!("failed to parse '{}'", body))?; - + trace!(%body, "extracted signature"); Ok(Self(sig)) } }