Skip to main content

Module webhook

Module webhook 

Source
Expand description

Webhook signature verification.

The API signs every delivery with X-OpenSMS-Signature: t=<unix seconds>,v1=<hex>, where v1 = hex(HMAC-SHA256(secret, "<t>." + raw body)) and secret is the full whsec_... string returned once by webhooks.create. Parsing mirrors the server exactly. These functions need no client or API key.

Structs§

VerifyOptions
Options for verify_signature and construct_event.

Constants§

DEFAULT_TOLERANCE_SECONDS
Default allowed clock skew, in seconds.
SIGNATURE_HEADER
The header that carries the signature.

Functions§

construct_event
Verify the signature, then parse the event envelope. Fails with an OpensmsError whose code is invalid_signature or expired_signature.
verify_signature
true when header is a valid, fresh signature of payload (the exact raw body bytes) under secret.