jwx

A complete, opinionated Go implementation of the JOSE stack: JWT, JWS, JWE, JWK, and JWA.

Library
Go
vv4.5.0
2,425stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
89/100Excellent
Development Activity100
Maintenance96
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
88/100Excellent
Architecture88
Code Quality90
Innovation88
Learning Curve85

jwx is a Go module implementing the full family of JOSE (Javascript Object Signing and Encryption) technologies: JWA, JWE, JWK, JWS, and JWT. Rather than shipping a minimal JWT-only helper, it covers the wider spec surface, including JWS messages with multiple signatures, detached and unencoded payloads, and JWE messages with multiple recipients, in both compact and JSON serialization forms.

The API follows a consistent, symmetric convention across packages, jws.Parse/Verify/Sign, jwe.Parse/Encrypt/Decrypt, jwt.Parse/Sign, with explicit required parameters and optional WithXXXX()-style functional options built on lestrrat-go/option. Most operations accept either a jwk.Key or a raw Go crypto key (*rsa.PrivateKey, *ecdsa.PrivateKey, etc.), so teams already holding standard-library key types are not forced through a conversion step.

Beyond the core RFCs, jwx has been extended to cover post-quantum primitives (ML-KEM, ML-DSA, HPKE) and ships an opt-in extension-module architecture, letting the core module stay lean while companion repositories under the jwx-go GitHub org add niche algorithms (ES256K, Ed448, JWKS caching, migration tooling) without bloating the main dependency tree.

What You Get

  • Full JWA/JWE/JWK/JWS/JWT coverage, not just a minimal JWT parser: multi-signature and multi-recipient JOSE messages, detached payloads, and RFC 7797 unencoded payloads
  • A uniform, opinionated API surface (Parse/Verify/Sign, Parse/Encrypt/Decrypt) with functional WithXXXX() options instead of ad-hoc config structs
  • Interoperability with both jwk.Key and raw standard-library crypto keys (*rsa.PrivateKey, *ecdsa.PrivateKey) across signing, verification, and encryption calls
  • Post-quantum cryptography support (ML-KEM, ML-DSA, HPKE) alongside classical RSA/ECDSA/EdDSA/HMAC algorithms
  • An opt-in extension-module system (companion repos for JWKS caching, ES256K, Ed448, migration helpers) that keeps the core module’s dependency footprint small
  • First-class HTTP integration via jwt.ParseRequest for pulling and verifying bearer tokens straight off an *http.Request
  • Bazel build support (BUILD.bazel, MODULE.bazel) alongside standard go build/go test workflows

Common Use Cases

  • Issuing and verifying signed JWT access/ID tokens for an API or auth server, including OpenID Connect claims via the jwt/openid subpackage
  • Encrypting sensitive payloads (not just tokens) with JWE for secure transport between services
  • Parsing and rotating JWKS (JSON Web Key Sets) fetched from an identity provider, with the jwkfetch companion module keeping a key set continuously up to date
  • Verifying bearer tokens directly from incoming HTTP requests in a middleware layer via jwt.ParseRequest
  • Building systems that need forward-looking, post-quantum-safe signing or key-encapsulation alongside today’s classical algorithms

Under The Hood

Architecture jwx is organized as one package per JOSE specification, jwa (algorithm identifiers), jwk (key representation and conversion), jws (signing/verification), jwe (encryption), and jwt (token building/parsing), each independently importable, with shared low-level machinery (base64 handling, a pluggable JSON codec, object pooling, key-type conversion) centralized under internal/. The top-level jwx.go file documents module-wide design decisions, such as staying buffer-oriented rather than adding true streaming support, showing the maintainers reason explicitly about API-wide tradeoffs rather than letting each package diverge. Extension algorithms (ES256K, Ed448, ML-KEM/ML-DSA/HPKE variants) live in separate companion repositories tracked via companions.yaml, keeping the core module’s own dependency graph small while still allowing the ecosystem to grow.

Tech Stack Built for Go 1.26+, jwx has adopted the still-experimental encoding/json/v2 API (gated behind GOEXPERIMENT=jsonv2 on 1.26, standard by 1.27), wrapped behind an internal JSON abstraction so the rest of the codebase isn’t coupled to a specific encoder. External dependencies are deliberately minimal: lestrrat-go/dsig and lestrrat-go/option from the same maintainer’s ecosystem, valyala/fastjson, and golang.org/x/crypto, with stretchr/testify reserved for tests. The project supports both standard go build and Bazel (MODULE.bazel, per-package BUILD.bazel files), and leans on code generation (go:generate directives driving jwxcodegen scripts and stringer) to keep accessors and option types consistent across packages instead of hand-maintaining boilerplate.

Code Quality Testing is extensive and layered: roughly 124 test files against about 190 non-test source files, including fuzz tests in multiple packages (fuzz_test.go in jwk, jws, jwx itself) backed by a dedicated fuzz.yml GitHub Actions workflow, plus benchmark tests, CodeQL static analysis, a separate lint workflow, a smoke-test workflow, and a companion-tests.yml workflow that verifies the extension modules still build against the core. Errors are handled through per-package errors.go files defining typed error values rather than bare string errors, and comment density in core files is high (100+ doc comments per file in jwt.go, jwk.go, jws.go), indicating the API surface is documented close to the code rather than only in external docs.

API Design The library’s defining choice is symmetry: every JOSE operation follows the same Parse/verb/WithXXXX()-option shape, so learning jws.Sign largely transfers to learning jwe.Encrypt or jwt.Sign. It ships a bundled Claude Code skill (jwx-dev-v4) specifically to help AI coding assistants pick the right algorithm and avoid common JOSE footguns, an unusually deliberate investment in developer experience for a cryptography library. A dedicated MIGRATION.md and versioned Changes-vN.md files give users a concrete upgrade path across the v2/v3/v4 major-version boundaries, which matters for a module whose import path changes on every semver-major bump under Go’s module versioning rules.

Used by 8 apps in this directory

Go
55%
Apache 2.0

Authgear

Authentication

2,047

Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Go55%
HTML24%
TypeScript17%
Updated 3 days ago
Go
65%
Other

Hanko

Security · Authentication

9,025

Open source, self-hostable authentication platform with passkeys, SAML SSO, and OAuth — the privacy-first alternative to Auth0 and Clerk.

View details
89
Repo Health
81
Technical
66
Dependency
Built with
Go65%
TypeScript30%
Updated 4 days ago
Go
81%
GPL 3.0

Navidrome

File Storage

23,561

Run your own personal Spotify — stream your entire music collection from any device, anywhere, forever.

View details
91
Repo Health
81
Technical
69
Dependency
Built with
Go81%
JavaScript15%
Updated 2 days ago
Go
91%
Apache 2.0

Ory Kratos

Authentication

13,877

API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.

View details
82
Repo Health
78
Technical
65
Dependency
Built with
Go91%
Updated 1 months ago
Go
91%
Apache 2.0

Ory Kratos

Authentication

13,877

API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.

View details
82
Repo Health
78
Technical
65
Dependency
Built with
Go91%
Updated 1 months ago
Go
81%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,271

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
Go81%
TypeScript12%
Updated 2 days ago
Go
98%
Apache 2.0

Space Cloud

Devops · Authentication

3,999

Kubernetes-native serverless platform that generates instant GraphQL and REST APIs for any database with built-in auth and real-time subscriptions

View details
50
Repo Health
74
Technical
62
Dependency
Built with
Go98%
Updated 2 years ago
Go
95%
Apache 2.0

TiDB

Databases · AI Development

40,528

AI-Native Distributed SQL Database for Agentic Workloads

View details
97
Repo Health
66
Technical
68
Dependency
Built with
Go95%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search