eventwebhook

package
v3.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 7 Imported by: 0

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