webhookv3

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package webhookv3 provides functionality for working with V3 PagerDuty Webhooks, including signature verification and decoding.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

View Source
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

func VerifySignature(r *http.Request, secret string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL