Webhook Signature
A webhook signature is a provider-computed HMAC over the raw HTTP request body that allows the backend to verify the sender and detect modifications to the content. The backend calculates the expected signature using the shared secret and compares it with the value in the X-Signature header using constant-time comparison before parsing the JSON.
Minimal example
mac := hmac.New(sha256.New, secret)
mac.Write(body)
expected := mac.Sum(nil)
provided, err := hex.DecodeString(signature)
if err != nil || !hmac.Equal(expected, provided) {
return ErrInvalidSignature
}