Back to godoc.org

Package echo

v0.0.0-...-1041ef6
Latest Go to latest

The latest major version is .

Published: Dec 26, 2019 | License: MIT | Module: github.com/pratikmallya/clubhouse-webhook

Index

func HeaderVerification

func HeaderVerification(config Config, skipper middleware.Skipper) echo.MiddlewareFunc

HeaderVerification is a verification middleware that only allows requests that are verified to originate from Clubhouse when generated with a secret. From https://clubhouse.io/api/webhook/v1/#Signature: If you provide a secret when you create the Outgoing Webhook, it will include an HTTP header named Clubhouse-Signature. The value of this header is a cryptographic hash encoded in hexadecimal.

The signature is computed by the HMAC-SHA-256 algorithm. The ‘message’ is the HTTP request body encoded in UTF-8. The ‘secret’ is the secret string you provided, also encoded in UTF-8.

type Config

type Config struct {
	// Key is the secret used for generating HMAC digest. This is the secret provided to Cluhouse when configuring
	// webhooks.
	Key []byte
}

func NewConfig

func NewConfig(key string) Config

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier