Every webhook delivery includes an HMAC-SHA256 signature in the X-BitByBit-Webhook-Signature header. Always verify this signature to ensure the request is genuinely from bitbybit.
The signature is computed over the raw request body bytes, exactly as received. A re-serialized JSON object (for example JSON.stringify(req.body) after express.json()) can produce different bytes and fail verification. Capture the raw body before parsing — in Express, use express.raw({ type: 'application/json' }).
Always check the t (timestamp) value in the signature header. Reject any webhook where the timestamp is more than 5 minutes old. This prevents replay attacks where an attacker resends a previously captured webhook request.