sign

package
v0.5.1-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSignedToken

func GenSignedToken(option SignOption) (string, error)

func Middleware

func Middleware(secret []byte, requireToken bool) func(next http.Handler) http.Handler

Types

type JWT

type JWT struct {
	Secret string `yaml:"secret"` // JwtSecret is the secret used to sign the JWT
	TTL    int64  `yaml:"ttl"`    // JwtTTL is the time to live for the JWT in seconds
}

type SignOption

type SignOption struct {
	Username string
	UserID   int64
	Duration time.Duration
	Secret   []byte
}

Jump to

Keyboard shortcuts

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