webhooks

package
v0.0.0-...-cee86e0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHeader    = errors.New("webhook has invalid WorkOS header")
	ErrNoValidSignature = errors.New("webhook had no valid signature")
	ErrNotSigned        = errors.New("webhook has no WorkOS header")
	ErrInvalidTimestamp = errors.New("webhook has an invalid timestamp")
	ErrOutsideTolerance = errors.New("webhook has a timestamp that is out of tolerance")
)

This represents the list of errors that could be raised when using the webhook package.

Functions

This section is empty.

Types

type Client

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

The Client used to interact with Webhooks.

func NewClient

func NewClient(secret string) *Client

Constructs a new Client.

func (*Client) SetNow

func (c *Client) SetNow(now func() time.Time)

Sets the function used to determine the current time. Usually you'll only need to call this for testing purposes.

func (*Client) SetTolerance

func (c *Client) SetTolerance(tolerance time.Duration)

Sets the maximum time tolerance between now and when the webhook timestamp was issued.

func (*Client) ValidatePayload

func (c *Client) ValidatePayload(workosHeader string, bodyString string) (string, error)

Jump to

Keyboard shortcuts

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