token

package
v0.0.0-...-b06ca14 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TOKEN_KEY     = os.Getenv("TOKEN_KEY")
	TOKEN_EXPIRED = 10 * 60 * time.Second
)

Functions

func GenerateToken

func GenerateToken(userId int) (string, error)

Types

type Payload

type Payload struct {
	UserID  int       `json:"user_id"`
	Expired time.Time `json:"expired"`
}

func ValidateToken

func ValidateToken(tokenString string) (*Payload, error)

Jump to

Keyboard shortcuts

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