webhook

package
v1.167.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoTemplateEvaluator added in v1.165.0

type GoTemplateEvaluator struct{}

GoTemplateEvaluator evaluates Go template expressions against JSON payloads

func NewGoTemplateEvaluator added in v1.165.0

func NewGoTemplateEvaluator() *GoTemplateEvaluator

NewGoTemplateEvaluator creates a new GoTemplateEvaluator

func (*GoTemplateEvaluator) Evaluate added in v1.165.0

func (e *GoTemplateEvaluator) Evaluate(payload map[string]interface{}, templateStr string) (bool, error)

Evaluate evaluates a Go template expression against a payload The template should return "true" or "false" as a string Returns true if the template evaluates to "true", false otherwise

type JSONPathEvaluator

type JSONPathEvaluator struct{}

JSONPathEvaluator evaluates JSONPath conditions against JSON payloads

func NewJSONPathEvaluator

func NewJSONPathEvaluator() *JSONPathEvaluator

NewJSONPathEvaluator creates a new JSONPathEvaluator

func (*JSONPathEvaluator) Evaluate

func (e *JSONPathEvaluator) Evaluate(payload map[string]interface{}, conditions []entities.WebhookJSONPathCondition) (bool, error)

Evaluate evaluates all JSONPath conditions against a payload Returns true if all conditions match, false otherwise

func (*JSONPathEvaluator) EvaluateAny

func (e *JSONPathEvaluator) EvaluateAny(payload map[string]interface{}, conditions []entities.WebhookJSONPathCondition) (bool, error)

EvaluateAny evaluates conditions with OR logic (returns true if any condition matches) This is useful for scenarios where you want to match multiple possible values

type SignatureConfig

type SignatureConfig struct {
	// HeaderName is the name of the HTTP header containing the signature
	// Examples: "X-Hub-Signature-256", "X-Signature"
	HeaderName string

	// Secret is the shared secret used for HMAC computation
	Secret string

	// Algorithm specifies the hash algorithm to use
	// Supported values: "sha256", "sha1", "sha512"
	Algorithm string
}

SignatureConfig contains configuration for signature verification

type SignatureVerifier

type SignatureVerifier struct{}

SignatureVerifier provides HMAC signature verification for webhooks

func NewSignatureVerifier

func NewSignatureVerifier() *SignatureVerifier

NewSignatureVerifier creates a new SignatureVerifier

func (*SignatureVerifier) Verify

func (v *SignatureVerifier) Verify(payload []byte, signatureHeader string, config SignatureConfig) bool

Verify verifies an HMAC signature against a payload Returns true if the signature is valid, false otherwise

func (*SignatureVerifier) VerifyGitHubSignature

func (v *SignatureVerifier) VerifyGitHubSignature(payload []byte, signatureHeader, secret string) bool

VerifyGitHubSignature is a convenience method for verifying GitHub webhook signatures It handles both X-Hub-Signature (SHA1) and X-Hub-Signature-256 (SHA256)

Jump to

Keyboard shortcuts

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