Documentation
¶
Overview ¶
Package webhook provides Wocha webhook signature verification and event parsing.
Verify incoming webhook payloads before processing:
event, err := webhook.Verify(payload, signatureHeader, secret)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignPayload ¶
SignPayload creates a signature header for testing. It is not intended for production use.
func VerifySignature ¶
func VerifySignature(payload []byte, signatureHeader, secret string, opts ...VerifyOptions) bool
VerifySignature reports whether the webhook signature is valid.
Types ¶
type Event ¶
type Event struct {
EventID string `json:"event_id"`
EventType string `json:"event_type"`
Timestamp string `json:"timestamp"`
IdempotencyKey string `json:"idempotency_key"`
Data json.RawMessage `json:"data"`
}
Event is a parsed Wocha webhook event payload.
type VerifyOptions ¶
type VerifyOptions struct {
// Tolerance is the maximum age of the signature timestamp. Default: 5 minutes.
Tolerance time.Duration
}
VerifyOptions configures webhook signature verification.
Click to show internal directories.
Click to hide internal directories.