jwt

package
v0.0.0-...-0941746 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenIsNotValid     = errors.New("The token is not valid")
	ErrSignatureIsNotValid = errors.New("Signature is not valid")
	ErrTokenHasExpired     = errors.New("The token has expired")
	ErrAlgorithmIsNotValid = fmt.Errorf("Algorithm is not valid. Valid algorithms values are: [%s, %s]", AlgorithmHS256, AlgorithmHS512)
)

Functions

This section is empty.

Types

type Algorithm

type Algorithm string
const (
	AlgorithmHS256 Algorithm = "HS256"
	AlgorithmHS512 Algorithm = "HAS512"
)

type NewProviderOptions

type NewProviderOptions struct {
	VerifyingKeys [][]byte
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(signingSecretKey []byte, algorithm Algorithm, options *NewProviderOptions) (provider *Provider, err error)

func (*Provider) IssueToken

func (provider *Provider) IssueToken(data any, options *TokenOptions) (token string, err error)

func (*Provider) VerifyToken

func (provider *Provider) VerifyToken(token string, data any) (err error)

type TokenOptions

type TokenOptions struct {
	ExpirationTime *time.Time
	NotBefore      *time.Time
}

type Type

type Type string
const (
	TypeJWT Type = "JWT"
)

Jump to

Keyboard shortcuts

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