tokenutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken      = errors.New("invalid token")
	ErrTokenExpired      = errors.New("token expired")
	ErrIncorrectIssuedAt = errors.New("token issued at different time")
	ErrTokenIssuedBefore = errors.New("token issued before")
	ErrIncorrectIssuer   = errors.New("incorrect issuer")
)

Functions

func IssueAccessToken

func IssueAccessToken(issuer string, privateKey crypto.PrivateKey, days int) (string, error)

IssueAccessToken issues signed string of access token.

func IssueRefreshToken

func IssueRefreshToken(issuer string, privateKey crypto.PrivateKey, days int) (string, error)

IssueRefreshToken issues signed string of refresh token.

func ValidateAccessToken

func ValidateAccessToken(accessToken string, publicKey crypto.PublicKey) error

ValidateAccessToken parses access token.

Types

type Claims

type Claims struct {
	Type string `json:"type"`
	jwt.RegisteredClaims
}

Claims is a custom claims for jwt token.

Jump to

Keyboard shortcuts

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