jwtest

package
v2.10.49 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(t *testing.T, store *KeyStore) *httptest.Server

Types

type KeyStore

type KeyStore struct {
	PrivateKey jwk.ECDSAPrivateKey
	PublicSet  jwk.Set
}

KeyStore holds an ECDSA private key for signing JWTs and a public JWKS that can be served from a mock JWKS endpoint for verification.

func Store

func Store() *KeyStore

Store creates a new ECDSA P-256 key pair suitable for signing and verifying JWTs with the ES256 algorithm.

func (*KeyStore) Sign

func (kp *KeyStore) Sign(builder *jwt.Builder) string

Sign signs the given JWT token using the key pair's private key with ES256 and returns the serialized compact-form token string.

func (*KeyStore) SignToken

func (kp *KeyStore) SignToken(token jwt.Token) string

SignToken signs the given JWT token using the key pair's private key with ES256 and returns the serialized compact-form token string.

Jump to

Keyboard shortcuts

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