Documentation ¶
Overview ¶
Package webhookv3 provides functionality for working with V3 PagerDuty Webhooks, including signature verification and decoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMalformedBody = errors.New("HTTP request body is either empty or malformed")
ErrMalformedBody is returned when the *http.Request body is either missing or malformed. When receiving this error, it's recommended that the server return HTTP 400 to prevent redelivery.
var ErrMalformedHeader = errors.New("X-PagerDuty-Signature header is either missing or malformed")
ErrMalformedHeader is returned when the *http.Request is missing the X-PagerDuty-Signature header. When receiving this error, it is recommended that the server return HTTP 400 to prevent redelivery.
var ErrNoValidSignatures = errors.New("invalid webhook signature")
ErrNoValidSignatures is returned when a webhook is not properly signed with the expected signature. When receiving this error, it is reccommended that the server return HTTP 403 to prevent redelivery.
Functions ¶
func VerifySignature ¶
VerifySignature compares the provided signature of a PagerDuty v3 Webhook against the expected value and returns an ErrNoValidSignature error if the values do not match. This function may also return ErrMalformedHeader or ErrMalformedBody if the request appears to be malformed.
See https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTkz-verifying-signatures for more details.
This function will fail to read any HTTP request body that's 2MB or larger.
Types ¶
This section is empty.