jwt

package
v1.0.0-with-auth Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTAuth

type JWTAuth interface {
	IssueAccessToken(id string) (*Token, error)
	IssueRefreshToken(id string) (*Token, error)
	VerifyAccessToken(at string) (*Token, error)
	VerifyRefreshToken(rt string) (*Token, error)
}

func NewJWTAuth

func NewJWTAuth(
	l logger.Logger,
	secret, refreshSecret []byte,
	lifetime, refreshLifetime int,
	issuer, audience string,
) JWTAuth

type Token

type Token struct {
	Token     *string    `json:"token,omitempty"`
	Issuer    string     `json:"iss,omitempty"`
	Subject   string     `json:"sub,omitempty"`
	Audience  []string   `json:"aud,omitempty"`
	ExpiresAt *time.Time `json:"exp,omitempty"`
	IssuedAt  *time.Time `json:"iat,omitempty"`
}

Jump to

Keyboard shortcuts

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