A webhook endpoint is a public address that acts on what it receives. Without verification it acts on whatever anyone sends it. Terania signs every delivery with HMAC-SHA256 and your endpoint secret. Verification is five steps, and skipping any of them leaves a hole. Here are the five, and the habits around them.
Build the signed string from the timestamp, a full stop, then the raw body bytes. Timestamp, full stop, raw body. The body must be the raw bytes as received, never a re-serialised copy. Parsers reorder keys and normalise whitespace, and any change breaks the signature. Read the raw body first, verify against those bytes, and only then parse. Frameworks that parse before you see the bytes need their raw-body option switched on. Switch it on before anything else.
Compute HMAC-SHA256 of that string with the endpoint secret as the key. The secret is shown once as text encoding thirty two random bytes, and the server signs with the thirty two raw bytes, so decode the displayed secret before use. This is an easy step to get wrong. The text form is for display and storage. The byte form is for signing. Decode, then compute. Write the digest as lower-case hex. That is the expected value.
Compare in constant time and accept if any signature value matches. The header can carry more than one value, which matters during rotation. A normal string comparison stops at the first difference, leaking timing information about how much matched. A constant-time comparison does not. Every language in common use provides one. Use it. Reject when nothing matches, with a client error status. Note that most client errors kill the delivery at once, while timeouts and rate limits retry, so reject only what you mean to reject. A verification failure is a rejection. A busy server is a retry.
Reject if the difference between the timestamp and your clock exceeds three hundred seconds. The timestamp travels inside the signature header, and there is no separate timestamp header. Five minutes of skew covers real clocks and real networks while killing replays of old deliveries. Keep your server clock synchronised and this check never fires on honest traffic. Set a clock ten minutes wrong and verification fails on the timestamp, which is the check proving its worth.
Rotate secrets without dropping deliveries. When you rotate in the app, each delivery carries two signature values for five minutes: one from the new secret and one from the previous. Update your receiver inside that window. An option stops signing with the old secret at once, and rotating again ends the earlier window. Accepting any matching value is what makes rotation seamless. Code that checks only the first value breaks every rotation.
Build three receiver habits around the five steps. Verify first and reject with a client error when the check fails. Store the delivery ID before you act, because a delivery can arrive twice and the second arrival should find its ID already stored. Answer with success inside ten seconds and do slow work afterwards. Fetch the record by ID through the API for detail, because the body carries IDs only.
Test the way the guide suggests. A real delivery verifies and your endpoint answers success, with the log showing Delivered. Change one byte of the body and verification fails. Set your clock ten minutes wrong and verification fails on the timestamp. Three tests, each proving one step. There is no test button in the product, so trigger real events in test records and watch the log.
Five steps, three habits, three tests. Unverified input never touches your systems.
Find the signature in the Terania-Signature header, where the timestamp travels alongside the values. There is no separate timestamp header, so parse both from the one place. Frameworks that parse bodies before your code runs need their raw-body option enabled, otherwise you will verify against bytes the parser already changed. Express needs its raw middleware on the webhook route. Other frameworks have their equivalents. Set this up once in a shared receiver and every endpoint after inherits correct behaviour. When verification fails in production, check the clock first, the secret decoding second and the body handling third.



