common

package
v1.7.3 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: 10 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 common has what the webhook protocols share: their bodies as JSON values, signatures compared in constant time, and a JSON object's fields

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

Decode returns the body as JSON values: as it is, when it's JSON, an object of its fields, when it's a form, whose fields with more than one value are arrays, a string, when it's other text, or nil, when it's empty, or isn't text

func Equal

func Equal(signature, expected []byte) bool

Equal returns whether the signature, which isn't empty, is the expected one, in constant time

func EqualString

func EqualString(a, b string) bool

EqualString returns whether the strings, the first of which isn't empty, are equal, in constant time

func Field

func Field(values json.RawMessage, path ...string) string

Field returns the field of the JSON object, at the path, such as msg, id, as text, when it's a string, or a number, as it was sent, or empty, when it isn't one

func MediaType

func MediaType(header http.Header) string

MediaType returns the media type of the Content-Type header, without its parameters, or empty

func NoSecret

func NoSecret() error

NoSecret is the error of verifying a call of a webhook with no secret

Types

This section is empty.

Jump to

Keyboard shortcuts

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