webhook

package
v10.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadSignature = errors.New("webhook: signature verification failed")
	ErrClientError  = errors.New("webhook: client error (4xx)")
	ErrServerError  = errors.New("webhook: server error after all retries")
)

Functions

func VerifyPayload

func VerifyPayload(headers http.Header, body []byte, secret string) ([]byte, error)

VerifyPayload verifies a webhook payload signature on the receive side.

Types

type Delivery

type Delivery struct {
	ID        string
	URL       string
	Status    string // "delivered", "failed", "pending"
	Attempts  int
	LastError string
	SentAt    time.Time
}

type Option

type Option func(*Sender)

func MaxAttempts

func MaxAttempts(n int) Option

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

func NewSender

func NewSender(opts ...Option) *Sender

func (*Sender) Send

func (s *Sender) Send(url string, payload any, secret string) (string, error)

func (*Sender) Status

func (s *Sender) Status(id string) (Delivery, bool)

Jump to

Keyboard shortcuts

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