Webhooks¶
Verifying the service’s webhook deliveries.
A delivery is a POST of JSON with the header Luna-Signature: t=<seconds>,v1=<hex>: the
HMAC-SHA256, keyed with the webhook’s secret, of <seconds>.<body>. Check it against the
body exactly as received, before parsing it:
from lunaspace.webhooks import verify event = verify(secret, request.body, request.headers[“Luna-Signature”])
verify raises InvalidSignature for a delivery that is not the service’s, or that is
older than tolerance seconds (a replay); it returns the event, parsed.
- exception lunaspace.webhooks.InvalidSignature¶
The delivery’s signature does not hold, or is too old.
- lunaspace.webhooks.signature(secret, timestamp, body)¶
The signature’s
v1of a body sent attimestamp(seconds since 1970).