jwtx

package
v1.3.18 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewToken

func NewToken(data any, key string, opts ...Option) (string, error)

func NewTokenWithExp

func NewTokenWithExp(data any, key string) (string, error)

func ParseToken

func ParseToken[T any](tokenString string, secret string, target *T) error

func Valid

func Valid(tokenString string, secret string) (bool, error)

Types

type Option

type Option func(*TokenOption)

func WithAudOption

func WithAudOption(aud string) Option

func WithExpOption

func WithExpOption(expDurationSeconds int64) Option

func WithIssOption

func WithIssOption(iss string) Option

func WithSubOption

func WithSubOption(sub string) Option

type TokenOption

type TokenOption struct {
	Exp *jwt.NumericDate
	Sub string
	Aud string
	Iss string
}

Jump to

Keyboard shortcuts

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