generic

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 5 Imported by: ? 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.

Documentation

Overview

Package generic is the webhook protocol of a service which has none of its own: its calls are verified by the secret, as a bearer token, when the service can send one, and say nothing of what happened

Index

Constants

View Source
const Name = "generic"

Name is the protocol's name

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol struct{}

Protocol is the generic protocol

func New

func New() Protocol

New returns the protocol

func (Protocol) Check added in v1.7.4

func (Protocol) Check(string, http.Header) error

Check returns nil, as any call can be of a service without a protocol

func (Protocol) Decode

func (Protocol) Decode(header http.Header, body []byte) (json.RawMessage, error)

func (Protocol) Handshake

func (Protocol) Handshake(*http.Request, string) ([]byte, bool)

func (Protocol) Headers

func (Protocol) Headers() []string

func (Protocol) Identify

func (Protocol) Name

func (Protocol) Name() string

func (Protocol) Sample added in v1.7.4

func (Protocol) Sample(string) (http.Header, []byte)

Sample returns a call of JSON

func (Protocol) Sign added in v1.7.4

func (Protocol) Sign(header http.Header, _ []byte, secret string)

Sign sets the secret as a bearer token, in the Authorization header

func (Protocol) Verify

func (Protocol) Verify(header http.Header, _ []byte, secret string) error

Verify returns nil when the call has the secret as a bearer token, in its Authorization header, whose scheme is of any case

Jump to

Keyboard shortcuts

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