eventwebhook

package
v3.16.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 7 Imported by: 24 modules, 22 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

This helper allows you to quickly and easily enable/disable SecureWebhook feature or get the public key through Twilio SendGrid.

Dependencies

Quick Start

Run the example (make sure you have set your environment variable to include your SENDGRID_API_KEY).

go run examples/eventwebhook/eventwebhook.go

Usage

Test

go test ./... -v

or

cd helpers/eventwebhook
go test -v

Documentation

Index

Constants

View Source
const (
	// VerificationHTTPHeader is the signature verification http header name for the signature being sent
	VerificationHTTPHeader = "X-Twilio-Email-Event-Webhook-Signature"
	// TimestampHTTPHeader is the timestamp http header name for timestamp
	TimestampHTTPHeader = "X-Twilio-Email-Event-Webhook-Timestamp"
)

Variables

This section is empty.

Functions

func ConvertPublicKeyBase64ToECDSA

func ConvertPublicKeyBase64ToECDSA(base64PublicKey string) (*ecdsa.PublicKey, error)

ConvertPublicKeyBase64ToECDSA takes a base64 ECDSA public key and converts it into the ECDSA Public Key type

func GetRequestBody

func GetRequestBody(s *Settings) ([]byte, error)

GetRequestBody ...

func VerifySignature

func VerifySignature(publicKey *ecdsa.PublicKey, payload []byte, signature, timestamp string) (bool, error)

VerifySignature uses the ECDSA publicKey and verifies received payload and signature

Types

type RS

type RS struct {
	R *big.Int
	S *big.Int
}

RS represents the ECDSA signature

type Settings

type Settings struct {
	EnableSignedWebhook *bool `json:"enabled,omitempty"`
}

Settings ...

func NewSettings

func NewSettings() *Settings

NewSettings ...

func (*Settings) SetEnableSignedWebhook

func (s *Settings) SetEnableSignedWebhook(enable bool)

SetEnableSignedWebhook ...

Jump to

Keyboard shortcuts

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