token

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPrivateKey = errors.New("cannot issue token: private key is missing")
	ErrInvalidClaims     = errors.New("invalid token claims")
)

Functions

func LoadKeysFromFiles added in v0.2.0

func LoadKeysFromFiles(privPath, pubPath string) (*rsa.PrivateKey, *rsa.PublicKey, error)

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
}

Claims defines the standard payload for the entire platform.

type JWTManager

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

Manager handles the creation and validation of JWTs.

func NewJWTManager

func NewJWTManager(priv *rsa.PrivateKey, pub *rsa.PublicKey, issuer string) *JWTManager

NewJWTManager initializes the JWT logic.

func (*JWTManager) Issue

func (m *JWTManager) Issue(userID string, duration time.Duration) (string, error)

Issue generates new JWT token for a user.

Use only within the accounts service

func (*JWTManager) Validate

func (m *JWTManager) Validate(tokenString string) (*Claims, error)

Jump to

Keyboard shortcuts

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