jwtx

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(payload JPayload) (string, error)

func Init

func Init(opts ...Opt)

Types

type Config

type Config struct {
	//Key     string        `json:"key"`
	Secret  string        `json:"secret"`
	Expire  time.Duration `json:"expire"`
	Issuer  string        `json:"issuer"`
	Subject string        `json:"subject"`

	Method jwt.SigningMethod
}

type JClaims

type JClaims struct {
	Payload JPayload `json:"payload,omitempty"`
	jwt.StandardClaims
}

type JPayload

type JPayload map[string]interface{}

func ParseToken

func ParseToken(str string) (JPayload, error)

type Opt

type Opt func(*Config)

func SetExpire

func SetExpire(expire time.Duration) Opt

func SetIssuer

func SetIssuer(i string) Opt

func SetMethod

func SetMethod(m jwt.SigningMethod) Opt

func SetSecret

func SetSecret(secret string) Opt

func SetSubject

func SetSubject(sub string) Opt

Jump to

Keyboard shortcuts

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