pub struct SharedTokenScheme {
pub header: &'static str,
}Expand description
A shared-token scheme: the header carries the secret itself, in the
clear, and a value equal to the secret is what proves the delivery —
there is no signature over the body, so body is ignored entirely. The
comparison is the verifier’s constant-time one (the same helper the HMAC
path uses); a missing, empty or non-UTF-8 token refuses. Nothing here is
bound to time, so a captured token replays: claim each delivery’s event
id through the Inbox ledger.
Fields§
§header: &'static strThe header carrying the token.
Trait Implementations§
Source§fn extract(&self, headers: &HeaderMap, body: &[u8]) -> Option<SignedDelivery>
fn extract(&self, headers: &HeaderMap, body: &[u8]) -> Option<SignedDelivery>
Reads one delivery’s signature material out of the request headers
and the raw body bytes.
None on any input the scheme cannot fully
read; an empty candidate list counts as unreadable.Source§fn expected_signature(&self, key: &[u8], signed_payload: &[u8]) -> Vec<u8> ⓘ
fn expected_signature(&self, key: &[u8], signed_payload: &[u8]) -> Vec<u8> ⓘ
The signature bytes a matching delivery must carry, given the
derived
key and the bytes the scheme signed. The default is
HMAC(self.digest(), key, signed_payload); a shared-token scheme
overrides this to return the key’s own bytes, because for it the
header is the secret and there is nothing to compute. Read moreAuto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.