jwt

package
v0.0.0-...-5311485 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidToken = fmt.Errorf("invalid token")

Functions

func Generate

func Generate(payload Payload, params GenerateParams) (string, error)

func Inject

func Inject(ctx context.Context, payload Payload) context.Context

Types

type Claims

type Claims struct {
	Payload
	jwt.RegisteredClaims
}

type GenerateParams

type GenerateParams struct {
	SigningKey string
	TTL        time.Duration
}

type Payload

type Payload struct {
	Subject string `json:"subject"`
}

func Extract

func Extract(ctx context.Context) (Payload, bool)

func Parse

func Parse(tokenStr string) (Payload, error)

func Verify

func Verify(tokenStr string, params VerifyParams) (Payload, error)

type VerifyParams

type VerifyParams struct {
	SigningKey string
}

Jump to

Keyboard shortcuts

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