jwt

package
v0.0.0-...-c0e996c Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HS256 = "HS256" // HMAC SHA256 implementation
	HS384 = "HS384" // HMAC SHA384 implementation
	HS512 = "HS512" // HMAC SHA512 implementation
)

Suported Algorithms

Variables

View Source
var (
	ErrUnsupportedAlgorithm         = errors.New("Algorithm not supported")
	ErrHashNotAvailable             = errors.New("The specified hash is not available")
	ErrSignatureVerificationFailure = errors.New("Signature verification failed")
	ErrInvalidSegmentEncoding       = errors.New("Invalid segment encoding")
	ErrNotEnoughSegments            = errors.New("Not enough segments")
	ErrTooManySegments              = errors.New("Too many segments")
)

Functions

func Decode

func Decode(jwt string, key string, verify bool) (interface{}, error)

Decode returns the payload portion of the JWT and optionally verifies the signature

func Encode

func Encode(payload map[string]interface{}, customHeaders map[string]interface{}, key string, algorithm string) (string, error)

Encode generates a valid JWT with the given payload.

Types

This section is empty.

Jump to

Keyboard shortcuts

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