jwt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jwt provides JWT-based authentication primitives — signing helpers, HMAC + RSA verifiers, claims parsing — used by the kit/auth HTTP + gRPC interceptors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FxModule

func FxModule() fx.Option

func NewHMACIssuer

func NewHMACIssuer(secretKey string) (*hmacIssuer, error)

func NewHMACIssuerFromEnv

func NewHMACIssuerFromEnv() (*hmacIssuer, error)

Types

type Claims

type Claims struct {
	AccountID  uuid.UUID
	Username   string
	ExpiryTime time.Time
}

Claims represents JWT claims

func (*Claims) Expiry

func (c *Claims) Expiry() time.Time

func (*Claims) Get

func (c *Claims) Get(key string) any

func (*Claims) Subject

func (c *Claims) Subject() string

type Issuer

type Issuer interface {
	Issue(ctx context.Context, accountID uuid.UUID, username string) (string, error)
}

Issuer issues JWT tokens

type IssuerValidator

type IssuerValidator interface {
	Issuer
	Validator
}

IssuerValidator combines issuer and validator

type Validator

type Validator interface {
	Validate(ctx context.Context, token string) (*Claims, error)
}

Validator validates JWT tokens

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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