JWKServe
Zero-config JWT generation with JWKS support to accelerate local development and rapid prototyping.
Speed up local development with instant JWT generation. Running integration tests with JWT authentication based on JWKS typically requires a real identity provider—external services, API keys, network latency—all adding friction to your development loop. jwkserve eliminates this overhead: no external dependencies, no configuration files, just run the binary and start signing tokens locally. Generate JWT access tokens for any combination of claims while serving the OpenID Connect and JWKS endpoints your integrations expect.
Available as sbstjn/jwkserve on DockerHub and jwkserve.com.
Common JWKS Flow
When validating a JWT access token using JWKS per RFC 7519 and RFC 7517, here's what typically happens:
- Verify the token contains two period separators
- Split the token into
Header.Payload.Signaturevalues - Base64 decode
Header,Payload, andSignature - Use
kidinHeaderobject as reference for needed key - Use
issinPayloadto fetch the Discovery Endpoint at/.well-known/openid-configuration - Parse JSON structure and use
jwks_uriproperty as location for public keys - Fetch the provided JWKS Endpoint (usually at
/.well-known/jwks.json) - Parse JSON structure and retrieve key with
kidfrom JWTHeader
When writing automated tests for authentication and authorisation flows, requiring a real identity provider adds unnecessary complexity and slows iteration. jwkserve delivers zero-config JWKS endpoints and instant token generation, enabling rapid prototyping with arbitrary claims and token structures.
Installation
# Install jwkserve binary
# Install jwkserve binary without HTML UI
# OR: Download jwkserve container
Usage
Zero-config by design: jwkserve auto-generates cryptographic keys on startup and immediately serves all required endpoints. No configuration files, no external dependencies, no setup steps. Sign arbitrary payloads as valid JWT access tokens instantly—perfect for rapid prototyping, integration testing, and CI/CD pipelines where speed matters.
Start the binary:
# Use local binary
or use the provided Docker container:
# Use docker container
Now you're ready to generate valid JWT access tokens! Here's how:
}
That's it! You've got a valid JWT token. The token is complete and ready to use—the signature portion is truncated here for readability.
JWKS Flow
To enable the full JWKS flow, jwkserve serves two endpoints you'll need:
# OpenID Discovery Endpoint
{
}
# JWKS Key
{
{
}
}
Custom Keys
Zero-config defaults: serve auto-generates ephemeral keys on every startup—ideal for throwaway test environments. For faster restarts during iterative development, persist keys to disk:
# Generate RSA key (sizes: 2048, 3072, 4096)
# Generate ECDSA key (curves: 256, 384, 521)
# Use pre-generated key (instant startup)
For development, test fixtures are available:
Supported Algorithms
All six JWT signing algorithms are supported by default:
| Algorithm | Type | Curve/Size | Endpoint |
|---|---|---|---|
| RS256 | RSA | 2048-bit | /sign or /sign/RS256 |
| RS384 | RSA | 2048-bit | /sign/RS384 |
| RS512 | RSA | 2048-bit | /sign/RS512 |
| ES256 | ECDSA | P-256 | /sign/ES256 |
| ES384 | ECDSA | P-384 | /sign/ES384 |
| ES512 | ECDSA | P-521 | /sign/ES512 |
By default, all algorithms are enabled and exposed in JWKS. Configure specific algorithms:
# Enable only ES256 and ES384
Signing works with all algorithms regardless of JWKS configuration:
# Sign with ECDSA P-384
}
Build
If you're building from source, you can create binaries for both ARM and x86 architectures:
# Build ARM
# Build X86
To build a Docker container:
# Docker build for ARM
Container
Running the container is straightforward:
Docker Compose
Docker Compose makes it straightforward to use jwkserve in your development environment:
services:
jwkserve:
image: sbstjn/jwkserve
container_name: jwkserve
ports:
- "3000:3000"
command:
Code Coverage
