jwt

package
v0.0.0-...-d6003e4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken      error = fmt.Errorf("invalid token")
	ErrExpiredOrNotReady error = fmt.Errorf("token is either expired or not ready to use")
)

Errors.

Functions

This section is empty.

Types

type JSONWebToken

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

JSONWebToken is a concrete struct of json web token.

func NewJSONWebToken

func NewJSONWebToken(privateKey, publicKey []byte) *JSONWebToken

NewJSONWebToken is a constructor.

func (*JSONWebToken) Parse

func (a *JSONWebToken) Parse(ctx context.Context, tokenString string, claims jwt.Claims) (err error)

Parse will parse the token string to bearer claims.

func (*JSONWebToken) Sign

func (a *JSONWebToken) Sign(ctx context.Context, claims jwt.Claims) (tokenString string, err error)

Sign will generate new jwt token.

Jump to

Keyboard shortcuts

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