jwt

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(ttl time.Duration, payload int64, privateKey string) (string, error)

func DecodeToken

func DecodeToken(token, publicKey string) (interface{}, error)

func ValidateToken

func ValidateToken(token, publicKey string) (string, error)

Types

type JWTConfig

type JWTConfig struct {
	Access  Token `mapstructure:"accessToken"`
	Refresh Token `mapstructure:"refreshToken"`
}

type Token

type Token struct {
	PrivateKey string        `mapstructure:"privateKey"`
	PublicKey  string        `mapstructure:"publicKey"`
	ExpiresIn  time.Duration `mapstructure:"expiresIn"`
	MaxAge     int           `mapstructure:"maxAge"`
}

type TokenPair

type TokenPair struct {
	AccessToken  string `mapstructure:"accessToken"`
	RefreshToken string `mapstructure:"refreshToken"`
}

func GenerateTokenPair

func GenerateTokenPair(c *JWTConfig, uid int64) (*TokenPair, error)

type UserClaims

type UserClaims struct {
	ID string
}

Jump to

Keyboard shortcuts

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