pub struct Vercel;Expand description
Vercel’s scheme: header x-vercel-signature, a lowercase hex
HMAC-SHA1 over the raw body — no prefix, no timestamp header. The digest
is SHA-1 but the construction is HMAC, so SHA-1’s collisions do not
apply (see the module docs); with no timestamp, replay defence is the
Inbox dedup ledger’s job.
Trait Implementations§
impl Copy for Vercel
Source§impl SignatureScheme for Vercel
impl SignatureScheme for Vercel
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 digest(&self) -> Digest
fn digest(&self) -> Digest
The digest the scheme’s HMAC runs on. SHA-256 unless a provider
signs with SHA-1 (Vercel today). Ignored by a shared-token scheme,
which hashes nothing.
Source§fn secret_key<'a>(&self, secret: &'a str) -> Option<Cow<'a, [u8]>>
fn secret_key<'a>(&self, secret: &'a str) -> Option<Cow<'a, [u8]>>
The key bytes the HMAC runs over: the trimmed secret’s own bytes,
unless the scheme’s providers hand out encoded secrets (Svix’s
base64
whsec_…), which decode here. None refuses.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§
impl Freeze for Vercel
impl RefUnwindSafe for Vercel
impl Send for Vercel
impl Sync for Vercel
impl Unpin for Vercel
impl UnsafeUnpin for Vercel
impl UnwindSafe for Vercel
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