jwtest

package
v2.5.6 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 11 Imported by: 0

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