callback

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyIDScheme   = "https"
	KeyIDHostname = "zvelo.com"
)

KeyGetter validates the scheme and hostname of the KeyID before fetching. Only those that match these values will be considered valid.

Functions

func KeyGetter

func KeyGetter(cache KeyCache) httpsig.KeyGetter

KeyGetter returns an httpsig.KeyGetter that will properly fetch zvelo public keys, if cache is non nil, it will be used to cache keys.

func Middleware added in v1.5.0

func Middleware(getter httpsig.KeyGetter, h Handler, debug io.Writer) http.Handler

Middleware returns an http.Handler that can be used with an http.Server to receive and process zveloAPI callbacks. If getter is not nil, it will be used to validate HTTP Signatures on the incoming request.

Types

type Handler

type Handler interface {
	Handle(http.ResponseWriter, *http.Request, *msg.QueryResult)
}

A Handler responds to a zveloAPI callback

type HandlerFunc

type HandlerFunc func(http.ResponseWriter, *http.Request, *msg.QueryResult)

The HandlerFunc type is an adapter to allow the use of ordinary functions as zveloAPI handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(w http.ResponseWriter, r *http.Request, in *msg.QueryResult)

Handle calls f(w, r, in)

type KeyCache added in v1.5.0

type KeyCache interface {
	Get(string) *jose.JSONWebKeySet
	Set(string, *jose.JSONWebKeySet)
}

KeyCache is a simple interface for caching JSON Web Keys

func FileKeyCache added in v1.5.0

func FileKeyCache(cacheName string) KeyCache

FileKeyCache returns a KeyCache that stores keys on disk

func MemKeyCache added in v1.5.0

func MemKeyCache() KeyCache

MemKeyCache returns a KeyCache that stores keys in memory

Jump to

Keyboard shortcuts

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