jwt

package
v0.0.0-...-cab7921 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Supported hash 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")
)

Possible error conditions

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 creates a valid, signed JWT with the given payload and optional headers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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