pub struct Svix;Expand description
Svix’s scheme — the one Resend, Clerk and a growing list of providers
sign with. Headers svix-id / svix-timestamp / svix-signature (the
webhook-* aliases are accepted too); payload {id}.{timestamp}.{body};
signature header a space-separated list of <version>,<base64> pairs of
which only v1 is read — how an endpoint survives a secret rotation.
Trait Implementations§
impl Copy for Svix
Source§impl SignatureScheme for Svix
impl SignatureScheme for Svix
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 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 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 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 Svix
impl RefUnwindSafe for Svix
impl Send for Svix
impl Sync for Svix
impl Unpin for Svix
impl UnsafeUnpin for Svix
impl UnwindSafe for Svix
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