mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-21 17:00:59 +00:00
Implement DigestVerify for Vec, &mut []
This commit is contained in:
parent
77ecf6eaa7
commit
a2bc8c03ee
1 changed files with 18 additions and 0 deletions
|
@ -87,6 +87,24 @@ fn parse_digest_header() -> impl Filter<Extract = (Vec<DigestPart>,), Error = Re
|
|||
header::header::<Digest>("Digest").map(|d: Digest| d.parts)
|
||||
}
|
||||
|
||||
impl<T> DigestVerify for Vec<T>
|
||||
where
|
||||
T: DigestVerify,
|
||||
{
|
||||
fn verify(&mut self, parts: &[DigestPart], payload: &[u8]) -> bool {
|
||||
self.iter_mut().any(|d| d.verify(parts, payload))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> DigestVerify for &mut [T]
|
||||
where
|
||||
T: DigestVerify,
|
||||
{
|
||||
fn verify(&mut self, parts: &[DigestPart], payload: &[u8]) -> bool {
|
||||
self.iter_mut().any(|d| d.verify(parts, payload))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for DigestPart {
|
||||
type Err = ParseDigestError;
|
||||
|
||||
|
|
Loading…
Reference in a new issue