utils

package
v0.0.0-...-94e59cb Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(userid uint) string

func GetJWTSecretKey

func GetJWTSecretKey() string

Types

type JwtClaim

type JwtClaim struct {
	UserID uint
	jwt.StandardClaims
}

JwtClaim adds userid as a claim to the token

type JwtWrapper

type JwtWrapper struct {
	SecretKey       string
	Issuer          string
	ExpirationHours int64
}

JwtWrapper wraps the signing key and the issuer

func (*JwtWrapper) SignToken

func (j *JwtWrapper) SignToken(userid uint) (signedToken string, err error)

func (*JwtWrapper) ValidateToken

func (j *JwtWrapper) ValidateToken(signedToken string) (claims *JwtClaim, err error)

ValidateToken validates the jwt token

Jump to

Keyboard shortcuts

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