internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Algorithms = []string{"HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "EdDSA"}

Algorithms contains the list of accepted algorithms

Functions

func Decode

func Decode(token []byte, opt DecodeOptions) (string, error)

Decode jwt

func Encode

func Encode(opt EncodeOptions) (str string, err error)

Encode jwt

func ValidAlgorithm

func ValidAlgorithm(algorithm string) bool

ValidAlgorithm returns true for valid algorithm

func Validate

func Validate(token []byte, opt ValidateOptions) (string, error)

Validate jwt

Types

type DecodeOptions

type DecodeOptions struct {
	JSON   bool
	Output string
}

DecodeOptions specifies options for decoding

type EncodeOptions

type EncodeOptions struct {
	Header    map[string]string
	Payload   map[string]interface{}
	Algorithm string
	Secret    []byte
}

EncodeOptions specifies options for encoding

type ValidateOptions

type ValidateOptions struct {
	Issuer     string
	Subject    string
	Audience   []string
	Expiration time.Time
	NotBefore  time.Time
	IssuedAt   time.Time
	Jti        string
	Algorithm  string
	Secret     []byte
}

ValidateOptions specifies options for encoding

Jump to

Keyboard shortcuts

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