jwtutil

package
v0.0.0-...-aca82e5 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Package cloudeng.io/webapp/webauth/jwtutil

import cloudeng.io/webapp/webauth/jwtutil

Package jwtutil provides support for creating and verifying JSON Web Tokens (JWTs) managed by the github.com/lestrrat-go/jwx/v3/jwk package. This package provides simplified wrappers around the JWT signing and verification process to allow for more convenient usage in web applications.

Types

Type Signer
type Signer interface {
	Sign(context.Context, jwt.Token) ([]byte, error)
	PublicKey() (jwk.Key, error)
	Validator
}

Signer is an interface for signing and verifying JWTs.

Functions
func NewED25519Signer(priv ed25519.PrivateKey, id string) (Signer, error)

NewED25519Signer creates a new ED25519Signer instance with the given private key and key ID.

func NewSigner(jwkKey jwk.Key, id string, algo jwa.SignatureAlgorithm) (Signer, error)

NewSigner creates a new Signer instance with the given private key and key ID.

Type Validator
type Validator interface {
	ParseAndValidate(ctx context.Context, token []byte, validators ...jwt.ValidateOption) (jwt.Token, error)
}

Validator is an interface for validating JWTs.

Functions
func NewValidator(set jwk.Set) Validator

NewValidator creates a new Validator instance with the given key set.

Documentation

Overview

Package jwtutil provides support for creating and verifying JSON Web Tokens (JWTs) managed by the github.com/lestrrat-go/jwx/v3/jwk package. This package provides simplified wrappers around the JWT signing and verification process to allow for more convenient usage in web applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer interface {
	Sign(context.Context, jwt.Token) ([]byte, error)
	PublicKey() (jwk.Key, error)
	Validator
}

Signer is an interface for signing and verifying JWTs.

func NewED25519Signer

func NewED25519Signer(priv ed25519.PrivateKey, id string) (Signer, error)

NewED25519Signer creates a new ED25519Signer instance with the given private key and key ID.

func NewSigner

func NewSigner(jwkKey jwk.Key, id string, algo jwa.SignatureAlgorithm) (Signer, error)

NewSigner creates a new Signer instance with the given private key and key ID.

type Validator

type Validator interface {
	ParseAndValidate(ctx context.Context, token []byte, validators ...jwt.ValidateOption) (jwt.Token, error)
}

Validator is an interface for validating JWTs.

func NewValidator

func NewValidator(set jwk.Set) Validator

NewValidator creates a new Validator instance with the given key set.

Jump to

Keyboard shortcuts

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