jwt

package
v0.0.0-...-aa13637 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseUID

func ParseUID(token string) (uint64, error)

ParseUID get uid from a jwt

func SignAccessToken

func SignAccessToken(user *model.User) (token string, err error)

SignAccessToken signs a access token of a user

func SignRefreshToken

func SignRefreshToken(user *model.User) (token string, err error)

SignRefreshToken signs a refresh token of a user

Types

type TokenPayload

type TokenPayload struct {
	jwt.Payload
	UID      uint64 `json:"uid"`
	Username string `json:"username"`
}

TokenPayload is a convented JWT Payload struct

func Verify

func Verify(token []byte, key []byte) (*TokenPayload, error)

Verify validate token with given key

Jump to

Keyboard shortcuts

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