node-jose
A JavaScript implementation of JOSE (JWS, JWE, JWK, JWA) for Node.js and browsers
Repository Health
Technical Analysis
node-jose is a JavaScript implementation of the JSON Object Signing and Encryption (JOSE) family of RFCs — JWS, JWE, JWK, and JWA — covering nearly every algorithm and serialization format defined by the specs. It runs identically in Node.js and modern browsers, using native crypto (Node’s crypto module or the WebCrypto API) wherever the platform supports it.
The library centers on jose.JWK.KeyStore for managing collections of keys and jose.JWS/jose.JWE builder APIs for creating and verifying signatures or encrypting and decrypting content, all built on Promises rather than callbacks.
What You Get
- Full JWS (JSON Web Signature) support: create and verify signatures in compact, flattened, or JSON general serialization
- Full JWE (JSON Web Encryption) support: encrypt and decrypt content with a wide range of key-management and content-encryption algorithms
- JWK.KeyStore for importing, generating, exporting, and searching collections of keys (JSON, PEM, DER/PKCS8/SPKI/X.509 formats)
- Key thumbprint calculation (RFC 7638) and automatic
kidassignment for keys without one - Runs unmodified in both Node.js (via the
cryptomodule) and browsers (via WebCrypto), with Browserify/Webpack bundling support
Common Use Cases
- Verifying and decrypting JWTs/JWEs issued by an OAuth2 or OpenID Connect identity provider
- Signing outbound JSON payloads (JWS) for service-to-service authentication
- Managing a rotating set of signing/encryption keys via a JWK KeyStore in a Node.js auth service
- Encrypting sensitive JSON payloads end-to-end between a browser client and a backend using WebCrypto
Under The Hood
Architecture: the library is organized under lib/ into per-spec directories — jwk/ for key and keystore management, jws/ for signing/verification, jwe/ for encryption/decryption, algorithms/ for the underlying cryptographic primitives, and parse/ for content-type sniffing of incoming JWS/JWE material — with lib/index.js assembling them into the single jose namespace object consumers require(). Each JWS/JWE operation is exposed as a builder (createSign/createVerify, createEncrypt/createDecrypt) that accumulates input via .update() calls and resolves via .final(), mirroring Node’s streaming-hash API style. Tech Stack: pure JavaScript (99.7%) with a deps/ folder vendoring/shimming platform differences, lodash for utility functions, base64url for URL-safe encoding, and es6-promise as a Promise polyfill for older environments; a browser field in package.json swaps out the Node crypto module for a browser-compatible path. Code Quality: tests live under test/ and run via mocha across test/**/*-test.js, and the project historically used Greenkeeper for automated dependency updates, though the repository has seen very little commit activity since its last release (v2.2.0, 2023). API Design: the KeyStore/Key and JWS/JWE builder abstractions map closely to the underlying RFC concepts, which helps developers already familiar with the JOSE specs but adds a learning curve for newcomers; every asynchronous operation returns a native Promise, and the README’s structured, spec-aligned documentation covers most common flows in detail.
Used by 2 apps in this directory
Amplication
Developer Tools · AI Code Assistants · Automation
Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.
Ghost
CMS · Blogging
Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.