mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-25 10:51:01 +00:00
Simplify naming
This commit is contained in:
parent
1d37ebb812
commit
1202b7ff43
1 changed files with 5 additions and 5 deletions
|
@ -35,7 +35,7 @@ pub enum ParseDigestError {
|
||||||
#[error("Could not parse request body")]
|
#[error("Could not parse request body")]
|
||||||
pub struct ParseBodyError;
|
pub struct ParseBodyError;
|
||||||
|
|
||||||
pub fn verify_digest_bytes(
|
pub fn verify_bytes(
|
||||||
verifier: impl DigestVerify + Clone + Send,
|
verifier: impl DigestVerify + Clone + Send,
|
||||||
) -> impl Filter<Extract = (Bytes,), Error = Rejection> + Clone {
|
) -> impl Filter<Extract = (Bytes,), Error = Rejection> + Clone {
|
||||||
parse_digest_header()
|
parse_digest_header()
|
||||||
|
@ -52,26 +52,26 @@ pub fn verify_digest_bytes(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify_digest_json<T>(
|
pub fn verify_json<T>(
|
||||||
verifier: impl DigestVerify + Clone + Send
|
verifier: impl DigestVerify + Clone + Send
|
||||||
) -> impl Filter<Extract = (T,), Error = Rejection> + Clone
|
) -> impl Filter<Extract = (T,), Error = Rejection> + Clone
|
||||||
where
|
where
|
||||||
T: serde::de::DeserializeOwned,
|
T: serde::de::DeserializeOwned,
|
||||||
{
|
{
|
||||||
verify_digest_bytes(verifier).and_then(|bytes: Bytes| {
|
verify_bytes(verifier).and_then(|bytes: Bytes| {
|
||||||
async move {
|
async move {
|
||||||
serde_json::from_slice(&bytes).map_err(|_| warp::reject::custom(ParseBodyError))
|
serde_json::from_slice(&bytes).map_err(|_| warp::reject::custom(ParseBodyError))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify_digest_form<T>(
|
pub fn verify_form<T>(
|
||||||
verifier: impl DigestVerify + Clone + Send,
|
verifier: impl DigestVerify + Clone + Send,
|
||||||
) -> impl Filter<Extract = (T,), Error = Rejection> + Clone
|
) -> impl Filter<Extract = (T,), Error = Rejection> + Clone
|
||||||
where
|
where
|
||||||
T: serde::de::DeserializeOwned,
|
T: serde::de::DeserializeOwned,
|
||||||
{
|
{
|
||||||
verify_digest_bytes(verifier).and_then(|bytes: Bytes| {
|
verify_bytes(verifier).and_then(|bytes: Bytes| {
|
||||||
async move {
|
async move {
|
||||||
serde_urlencoded::from_bytes(&bytes).map_err(|_| warp::reject::custom(ParseBodyError))
|
serde_urlencoded::from_bytes(&bytes).map_err(|_| warp::reject::custom(ParseBodyError))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue