jwt

package
v0.0.0-...-dffa276 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(appKey string, secretkey string, username string) (string, int, error)

CreateToken create a jwt token.

func CreateTokenHMAC

func CreateTokenHMAC(appKey string, secretkey string, username string, expiration int64, signingKey string) (string, error)

CreateTokenHMAC creates a jwt token by HMAC method.

func CreateTokenRSA

func CreateTokenRSA(appKey string, secretkey string, username string, expiration int64, signingKeyString string) (string, error)

CreateTokenRSA creates a jwt token by RSA method.

func GenerateRSAKeys

func GenerateRSAKeys(bits int)

GenerateRSAKeys generate RSA keys(private and public).

func ParseTokenHMAC

func ParseTokenHMAC(userToken string, signingKey string) (*jwt.Token, error)

ParseTokenHMAC parses token by HMAC method.

func ParseTokenRSA

func ParseTokenRSA(userToken string, publicKey string) (*jwt.Token, error)

ParseTokenRSA parses token by RSA method. TODO: Error should be fixed. : token signature is invalid: key is of invalid type

func ValidateToken

func ValidateToken(userToken string, signingKey string) (map[string]interface{}, int, error)

ValidateToken validates a token.

func ValidateTokenClient

func ValidateTokenClient(userToken string) (map[string]interface{}, int, error)

ValidateTokenClient validate a token that generated from client

func ValidateTokenServer

func ValidateTokenServer(userToken string) (map[string]interface{}, int, error)

ValidateTokenServer validate a token that generated from API server

Types

This section is empty.

Jump to

Keyboard shortcuts

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