MandrillWebhookAuth

package module
v0.0.0-...-16a7a96 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2017 License: MIT Imports: 7 Imported by: 0 modules, 0 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

Mandrill Webhook Auth

Authenticates a Mandrill Webhook POST request.

Testing

The test doesn't contain the correct authentication data, if you want to test this yourself you'll need to generate your own data.

You can do this by going to requestb.in and creating a private bin. Then copy the bin URL and use it to create a new webhook in Mandrill. The authKey is the key value for the webhook so you can copy that in. Next click the test event button and refresh your requestbin. Finally copy the mandrill_events and X-Mandrill-Signature and run the test.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadSig is returned when verification with an incorrect
	// is used.
	ErrBadSig = errors.New("Bad Signature")
)

Functions

func SignRequest

func SignRequest(authKey string, req *http.Request) string

SignRequest returns a signature string given a HTTP request and a key.

func VerifyRequest

func VerifyRequest(req *http.Request, authKey string) error

VerifyRequest verifies a mandrill request authentication signature.

Types

type ByKey

type ByKey []KeyValue

ByKey implements the sortable interface for a KeyValue slice such that it is sorted by key, in non-decreasing order.

func (ByKey) Len

func (a ByKey) Len() int

func (ByKey) Less

func (a ByKey) Less(i, j int) bool

func (ByKey) Swap

func (a ByKey) Swap(i, j int)

type KeyValue

type KeyValue struct {
	Key string
	Val string
}

KeyValue holds a key and corresponding value, to be used for sorting collections of key-value pairs.

Jump to

Keyboard shortcuts

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