jwt_utils

package
v0.0.0-...-e299d79 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAccessToken

func GenerateAccessToken(payload TokenPayload) string

func GenerateDataMap

func GenerateDataMap(payload TokenPayload) map[string]interface{}

func GenerateRefreshToken

func GenerateRefreshToken(payload TokenPayload) string

func ValidateAccessToken

func ValidateAccessToken(tokenEncoded string) (*jwt.Token, error)

func ValidateRefreshToken

func ValidateRefreshToken(tokenEncoded string) (*jwt.Token, error)

Types

type TokenPayload

type TokenPayload struct {
	ID          string `json:"id,omitempty" structs:"id"`
	Key         string `json:"key,omitempty" structs:"key"`
	Email       string `json:"email,omitempty" structs:"email"`
	Alias       string `json:"alias,omitempty" structs:"alias"`
	IsExchanged bool   `json:"is_exchanged,omitempty" structs:"is_exchanged"`
	ReadOnly    bool   `json:"read_only,omitempty" structs:"read_only"`
	Type        string `json:"type,omitempty" structs:"type"`
}

func GetTokenData

func GetTokenData(claimData jwt.Claims) (*TokenPayload, error)

Jump to

Keyboard shortcuts

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