Versions in this module Expand all Collapse all v0 v0.2.1 Sep 12, 2026 v0.2.0 Sep 8, 2026 Changes in this version type Event + CorrelationID string v0.1.0 Sep 6, 2026 Changes in this version + const Version + var DefaultHeaders = Headers + var DefaultSchedule = Schedule + var ErrNotFound = errors.New("webhook: not found") + var ErrSignatureMalformed = errors.New("webhook: signature header malformed") + var ErrSignatureMismatch = errors.New("webhook: signature does not match any known secret") + var ErrSignatureStale = errors.New("webhook: signature timestamp outside the tolerance window") + func DefaultJitter(d time.Duration) time.Duration + func NewID() string + func NoJitter(d time.Duration) time.Duration + func ParseSignature(header string) (t time.Time, signatures []string, err error) + func Sign(secret []byte, t time.Time, body []byte) string + func SignatureHeader(t time.Time, body []byte, secrets ...[]byte) string + func Verify(header string, body []byte, secrets [][]byte, now time.Time, ...) error + type Clock func() time.Time + type Delivery struct + Attempts int + CreatedAt time.Time + EventID string + ID string + LastAttemptAt time.Time + LastError string + LastHTTPStatus int + NextAttemptAt time.Time + Status Status + SubscriptionID string + UpdatedAt time.Time + func (d *Delivery) Attempt(outcome Outcome, httpStatus int, errText string, now time.Time, s Schedule, ...) + func (d Delivery) Due(now time.Time) bool + type Dispatcher interface + Publish func(ctx context.Context, ev Event) ([]Delivery, error) + Subscribe func(ctx context.Context, sub Subscription) error + type Event struct + ClientID string + ID string + OccurredAt time.Time + Payload json.RawMessage + Type string + type Headers struct + Delivery string + Event string + Signature string + type InProcess struct + Clock Clock + NewID func() string + Store Store + func (p *InProcess) Publish(ctx context.Context, ev Event) ([]Delivery, error) + func (p *InProcess) Subscribe(ctx context.Context, sub Subscription) error + type Jitter func(time.Duration) time.Duration + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (m *MemoryStore) ByEvent(_ context.Context, eventID string) ([]Delivery, error) + func (m *MemoryStore) Due(_ context.Context, now time.Time, limit int) ([]Delivery, error) + func (m *MemoryStore) Enqueue(_ context.Context, deliveries []Delivery) error + func (m *MemoryStore) Event(_ context.Context, id string) (Event, error) + func (m *MemoryStore) SaveEvent(_ context.Context, ev Event) error + func (m *MemoryStore) SaveSubscription(_ context.Context, sub Subscription) error + func (m *MemoryStore) Subscription(_ context.Context, id string) (Subscription, error) + func (m *MemoryStore) Subscriptions(_ context.Context, clientID string) ([]Subscription, error) + func (m *MemoryStore) Update(_ context.Context, d Delivery) error + type Outcome int + const OutcomeDelivered + const OutcomeDrop + const OutcomeRetry + func Classify(status int, err error) Outcome + func (o Outcome) String() string + type Schedule []time.Duration + func (s Schedule) Delay(failedAttempts int) (time.Duration, bool) + type Secret struct + ExpiresAt time.Time + Value []byte + func (s Secret) Active(now time.Time) bool + type Status string + const StatusDeadLetter + const StatusDelivered + const StatusDropped + const StatusPending + const StatusRetrying + func (s Status) Terminal() bool + type Store interface + ByEvent func(ctx context.Context, eventID string) ([]Delivery, error) + Due func(ctx context.Context, now time.Time, limit int) ([]Delivery, error) + Enqueue func(ctx context.Context, deliveries []Delivery) error + Event func(ctx context.Context, id string) (Event, error) + SaveEvent func(ctx context.Context, ev Event) error + SaveSubscription func(ctx context.Context, sub Subscription) error + Subscription func(ctx context.Context, id string) (Subscription, error) + Subscriptions func(ctx context.Context, clientID string) ([]Subscription, error) + Update func(ctx context.Context, d Delivery) error + type Subscription struct + ClientID string + Enabled bool + EndpointURL string + EventTypes []string + ID string + Secrets []Secret + func (s Subscription) ActiveSecrets(now time.Time) [][]byte + func (s Subscription) Matches(eventType string) bool + type Worker struct + Client *http.Client + Clock Clock + Headers Headers + Jitter Jitter + MaxBodyDrain int64 + Schedule Schedule + Store Store + Timeout time.Duration + UserAgent string + func (w *Worker) Run(ctx context.Context, interval time.Duration, limit int, errs chan<- error) + func (w *Worker) RunOnce(ctx context.Context, limit int) (int, error)