webhookjobs

package
v0.0.0-...-e12325a Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry *supportjobs.Registry, worker *DeliverWorker)

Types

type DeliverArgs

type DeliverArgs struct {
	DeliveryID int64 `json:"delivery_id" river:"unique"`
}

func (DeliverArgs) EnqueueOptions

func (DeliverArgs) EnqueueOptions() supportjobs.EnqueueOptions

func (DeliverArgs) Kind

func (DeliverArgs) Kind() string

type DeliverWorker

type DeliverWorker struct {
	river.WorkerDefaults[DeliverArgs]
	Store  DeliveryStore
	Client *http.Client
	// Secrets 解密 signing secret;nil 时按明文使用(仅测试/无密钥开发)。
	Secrets SecretCipher
	// Migrator 可选懒迁移明文 secret。
	Migrator SecretMigrator
	// AllowHTTP 与配置时校验一致;生产应 false。
	AllowHTTP bool
	Now       func() time.Time
}

func (*DeliverWorker) Work

func (w *DeliverWorker) Work(ctx context.Context, job *river.Job[DeliverArgs]) error

type DeliveryStore

type DeliveryStore interface {
	GetDelivery(context.Context, int64) (webhooks.Delivery, error)
	UpdateDelivery(context.Context, webhooks.DeliveryUpdate) error
	GetEndpoint(context.Context, int64) (webhooks.EndpointRecord, error)
}

type SecretCipher

type SecretCipher interface {
	DecryptEndpointSecret(stored string) (string, error)
	MaybeMigrateSecret(stored string) (encrypted string, ok bool)
}

SecretCipher 解密 webhook 签名密钥(兼容历史明文)。

type SecretMigrator

type SecretMigrator interface {
	UpdateEndpointSecret(ctx context.Context, id int64, encrypted string) error
}

SecretMigrator 可选:将历史明文 secret 懒迁移为密文。

Jump to

Keyboard shortcuts

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