auth

package
v0.0.0-...-c8194c3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTClaims

type JWTClaims struct {
	UserID     string `json:"userID"`
	Username   string `json:"username"`
	Nickname   string `json:"nickname"`
	AvatarHash string `json:"avatarHash"`
	IsAdmin    bool   `json:"isAdmin"`
	jwt.RegisteredClaims
}

type JWTService

type JWTService struct {
	// contains filtered or unexported fields
}

func NewJWTService

func NewJWTService(key []byte) *JWTService

func (*JWTService) CreateJWT

func (j *JWTService) CreateJWT(userInfo UserInfo, ttl time.Duration) (string, error)

func (*JWTService) ParseJWT

func (j *JWTService) ParseJWT(token string) (*JWTClaims, error)

type UserInfo

type UserInfo struct {
	Nickname   string
	IsAdmin    bool
	AvatarHash string
	Username   string
	UserID     string
}

Jump to

Keyboard shortcuts

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