Struct truelayer_signing::Verifier
source · [−]pub struct Verifier<'a> { /* private fields */ }
Expand description
Builder to verify a request against a Tl-Signature
header.
See crate::verify_with_pem
for examples.
Implementations
sourceimpl<'a> Verifier<'a>
impl<'a> Verifier<'a>
sourcepub fn header(self, key: &'a str, value: &'a [u8]) -> Self
pub fn header(self, key: &'a str, value: &'a [u8]) -> Self
Add a header name & value. May be called multiple times to add multiple different headers.
All request headers may be added here, any headers not mentioned
in the jws signature header will be ignored unless required using
Verifier::require_header
.
sourcepub fn add_header(&mut self, key: &'a str, value: &'a [u8])
pub fn add_header(&mut self, key: &'a str, value: &'a [u8])
Add a header name & value. May be called multiple times to add multiple different headers.
All request headers may be added here, any headers not mentioned
in the jws signature header will be ignored unless required using
Verifier::require_header
.
sourcepub fn headers(
self,
headers: impl IntoIterator<Item = (&'a str, &'a [u8])>
) -> Self
pub fn headers(
self,
headers: impl IntoIterator<Item = (&'a str, &'a [u8])>
) -> Self
Appends multiple header names & values.
All request headers may be added here, any headers not mentioned
in the jws signature header will be ignored unless required using
Verifier::require_header
.
Example
truelayer_signing::verify_with_pem(key)
.headers([("X-Head-A", "123".as_bytes()), ("X-Head-B", "345".as_bytes())]);
sourcepub fn require_header(self, key: &'a str) -> Self
pub fn require_header(self, key: &'a str) -> Self
Require a header name that must be included in the Tl-Signature
.
May be called multiple times to add multiple required headers.
Signatures missing these will fail verification.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Verifier<'a>
impl<'a> Send for Verifier<'a>
impl<'a> Sync for Verifier<'a>
impl<'a> Unpin for Verifier<'a>
impl<'a> UnwindSafe for Verifier<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more