echo

package
Version: v0.0.0-...-77a4966 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 5 Imported by: 0

README

echo middleware

Middleware to use in a server using the [echo framework].

Example usage:

package main

import (
	"net/http"

	"github.com/labstack/echo/v4"

	echoMiddleWare "github.com/pratikmallya/clubhouse-webhook/echo"
)

func main() {
	e := echo.New()
	// testSecretClubhouse is the secret that you configure when setting up webhooks in clubhouse
	testSecretClubhouse := "some-secret"
	e.Use(echoMiddleWare.HeaderVerification(echoMiddleWare.NewConfig(testSecretClubhouse), nil))
	e.GET("/", func(c echo.Context) error {
		return c.NoContent(http.StatusNoContent)
	})
	e.Logger.Fatal(e.Start(":1323"))
}

[echo framework]: https://github.com/labstack/ echo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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
}

Config specifies configuration options for the middleware.

func NewConfig

func NewConfig(key string) Config

NewConfig returns a new Config with the provided configuration options.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL