signature

package
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HS256 = "HS256"
	HS384 = "HS384"
	HS512 = "HS512"
)

Variables

View Source
var (
	ErrInvalidKeyType  = errors.New("key is of invalid type")
	ErrHashUnavailable = errors.New("the requested hash function is unavailable")
)

Functions

func DecodeURLBase64

func DecodeURLBase64(raw string, receive interface{}) error

func EncodeToURLBase64

func EncodeToURLBase64(data interface{}) (string, error)

func Registry

func Registry(name string, f func() Signatory)

Types

type HMAC

type HMAC struct {
	Hash crypto.Hash
	// contains filtered or unexported fields
}
var (
	SignHAMCHS256       *HMAC
	SignHMACHS384       *HMAC
	SignHMACHS512       *HMAC
	ErrSignatureInvalid = errors.New("signature is invalid")
)

func (*HMAC) Name

func (h *HMAC) Name() string

func (*HMAC) Sign

func (h *HMAC) Sign(signingString string, key []byte) (string, error)

func (*HMAC) Verify

func (h *HMAC) Verify(verify, signed string, key []byte) error

type Signatory

type Signatory interface {
	Verify(verify, signed string, key []byte) error
	Sign(signingString string, key []byte) (string, error)
	Name() string
}

func GetSignatory

func GetSignatory(name string) Signatory

type SyncMap

type SyncMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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