jose 是一个用于处理 JSON Web Tokens (JWT) 和其他相关标准的库。它提供了一种简单而强大的方式来创建、验证和解析 JWT,以及处理 JWS(JSON Web Signature)和 JWE(JSON Web Encryption)。由于其全面的功能和灵活性,jose 成为许多开发者的首选库。然而,还有其他一些库可以作为替代方案。以下是一些替代库:
jsonwebtoken 是一个广泛使用的库,用于创建和验证 JSON Web Tokens。它提供了简单的 API 来生成和解析 JWT,并支持多种签名算法。jsonwebtoken 是一个成熟的解决方案,适合需要基本 JWT 功能的应用程序。如果你只需要简单的 JWT 处理,jsonwebtoken 是一个不错的选择。
jose is a JavaScript module for JSON Object Signing and Encryption, providing support for JSON Web Tokens (JWT), JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), JSON Web Key Set (JWKS), and more. The module is designed to work across various Web-interoperable runtimes including Node.js, browsers, Cloudflare Workers, Deno, Bun, and others.
Sponsor
If you want to quickly add JWT authentication to JavaScript apps, feel free to check out Auth0's JavaScript SDK and free plan. Create an Auth0 account; it's free!
Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.
Dependencies: 0
jose has no dependencies and it exports tree-shakeable ESM1.
The jose module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation.
The jose module supports encrypted JSON Web Tokens and provides functionality for encrypting and decrypting tokens, as well as their JWT Claims Set validation.
The jose module supports importing, exporting, and generating keys and secrets in various formats, including PEM formats like SPKI, X.509 certificate, and PKCS #8, as well as JSON Web Key (JWK).
The jose module supports digital signature and MAC computation and validation over arbitrary JWS Payloads using the JWS Compact Serialization and the flattened and general JWS JSON Serialization syntaxes (RFC 7515, Section 7).
The jose module supports encryption and authenticated decryption of arbitrary plaintext using the JWE Compact Serialization and the flattened and general JWE JSON Serialization syntaxes (RFC 7516, Section 7).
Please note that certain algorithms may not be available depending on the runtime used. You can find a list of available algorithms for each runtime in the specific issue links provided above.
The algorithm implementations in jose have been tested using test vectors from their respective specifications as well as RFC7520.
Footnotes
CJS style let jose = require('jose') is possible in Node.js versions where the require(esm) feature is enabled by default (^20.19.0 || ^22.12.0 || >= 23.0.0). ↩↩2↩3