jwt

package
v0.0.0-...-45c2084 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequired     = errors.New("ERR_REQUIRED")
	ErrAlgoMismatch = errors.New("ERR_ALGO_MISMATCH")
	ErrInvalid      = errors.New("ERR_INVALID")
)

Functions

This section is empty.

Types

type Algo

type Algo j.SigningMethod

type IOts

type IOts interface {
	Marshall() (string, error)
	Unmarshall(input string) (string, error)
	SetJti(jti string) IOts
	SetExp(exp time.Time) IOts
}

type Opts

type Opts struct {
	// Aud is audience of the token, example is "WEB" or "MOBILE"
	Aud string
	// Sub is subject of the token, example is "LOGIN"
	Sub string
	// Iss is issuer, example is "Apple ink."
	Iss string
	// Jti is a token ID
	Jti  string
	Algo Algo
	// Key for signature
	Key []byte
	// Exp is an expiration time
	Exp time.Time
}

func (Opts) Marshall

func (o Opts) Marshall() (string, error)

Marshall constructs a token from passed options

func (Opts) SetExp

func (o Opts) SetExp(exp time.Time) IOts

func (Opts) SetJti

func (o Opts) SetJti(jti string) IOts

func (Opts) Unmarshall

func (o Opts) Unmarshall(input string) (string, error)

Unmarshall parses JWT token string and returns jti

Jump to

Keyboard shortcuts

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