|
| 1 | +# `jose` API Documentation |
| 2 | + |
| 3 | +`jose` is 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. |
| 4 | + |
| 5 | +## Sponsor |
| 6 | + |
| 7 | +<picture> |
| 8 | + <source media="(prefers-color-scheme: dark)" srcset="../sponsor/Auth0byOkta_dark.png"> |
| 9 | + <source media="(prefers-color-scheme: light)" srcset="../sponsor/Auth0byOkta_light.png"> |
| 10 | + <img height="65" align="left" alt="Auth0 by Okta" src="../sponsor/Auth0byOkta_light.png"> |
| 11 | +</picture> |
| 12 | + |
| 13 | +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!][sponsor-auth0]<br><br> |
| 14 | + |
| 15 | +## [💗 Help the project](https://github.com/sponsors/panva) |
| 16 | + |
| 17 | +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](https://github.com/sponsors/panva). |
| 18 | + |
| 19 | +## Available modules |
| 20 | + |
| 21 | +**`example`** Deno import |
| 22 | +```js |
| 23 | +import * as jose from 'https://deno.land/x/[email protected]/index.ts' |
| 24 | +``` |
| 25 | + |
| 26 | +### JSON Web Tokens (JWT) |
| 27 | + |
| 28 | +The `jose` module supports JSON Web Tokens (JWT) and provides functionality for signing and verifying tokens, as well as their JWT Claims Set validation. |
| 29 | + |
| 30 | +- [JWT Claims Set Validation & Signature Verification](https://github.com/panva/jose/blob/v6.0.9/docs/jwt/verify/functions/jwtVerify.md) using the `jwtVerify` function |
| 31 | + - [Using a remote JSON Web Key Set (JWKS)](https://github.com/panva/jose/blob/v6.0.9/docs/jwks/remote/functions/createRemoteJWKSet.md) |
| 32 | + - [Using a local JSON Web Key Set (JWKS)](https://github.com/panva/jose/blob/v6.0.9/docs/jwks/local/functions/createLocalJWKSet.md) |
| 33 | +- [Signing](https://github.com/panva/jose/blob/v6.0.9/docs/jwt/sign/classes/SignJWT.md) using the `SignJWT` class |
| 34 | +- Utility functions |
| 35 | + - [Decoding Token's Protected Header](https://github.com/panva/jose/blob/v6.0.9/docs/util/decode_protected_header/functions/decodeProtectedHeader.md) |
| 36 | + - [Decoding JWT Claims Set](https://github.com/panva/jose/blob/v6.0.9/docs/util/decode_jwt/functions/decodeJwt.md) prior to its validation |
| 37 | + |
| 38 | +### Encrypted JSON Web Tokens |
| 39 | + |
| 40 | +The `jose` module supports encrypted JSON Web Tokens and provides functionality for encrypting and decrypting tokens, as well as their JWT Claims Set validation. |
| 41 | + |
| 42 | +- [Decryption & JWT Claims Set Validation](https://github.com/panva/jose/blob/v6.0.9/docs/jwt/decrypt/functions/jwtDecrypt.md) using the `jwtDecrypt` function |
| 43 | +- [Encryption](https://github.com/panva/jose/blob/v6.0.9/docs/jwt/encrypt/classes/EncryptJWT.md) using the `EncryptJWT` class |
| 44 | +- Utility functions |
| 45 | + - [Decoding Token's Protected Header](https://github.com/panva/jose/blob/v6.0.9/docs/util/decode_protected_header/functions/decodeProtectedHeader.md) |
| 46 | + |
| 47 | +### Key Utilities |
| 48 | + |
| 49 | +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). |
| 50 | + |
| 51 | +- Key Import Functions |
| 52 | + - [JWK Import](https://github.com/panva/jose/blob/v6.0.9/docs/key/import/functions/importJWK.md) |
| 53 | + - [Public Key Import (SPKI)](https://github.com/panva/jose/blob/v6.0.9/docs/key/import/functions/importSPKI.md) |
| 54 | + - [Public Key Import (X.509 Certificate)](https://github.com/panva/jose/blob/v6.0.9/docs/key/import/functions/importX509.md) |
| 55 | + - [Private Key Import (PKCS #8)](https://github.com/panva/jose/blob/v6.0.9/docs/key/import/functions/importPKCS8.md) |
| 56 | +- Key and Secret Generation Functions |
| 57 | + - [Asymmetric Key Pair Generation](https://github.com/panva/jose/blob/v6.0.9/docs/key/generate_key_pair/functions/generateKeyPair.md) |
| 58 | + - [Symmetric Secret Generation](https://github.com/panva/jose/blob/v6.0.9/docs/key/generate_secret/functions/generateSecret.md) |
| 59 | +- Key Export Functions |
| 60 | + - [JWK Export](https://github.com/panva/jose/blob/v6.0.9/docs/key/export/functions/exportJWK.md) |
| 61 | + - [Private Key Export](https://github.com/panva/jose/blob/v6.0.9/docs/key/export/functions/exportPKCS8.md) |
| 62 | + - [Public Key Export](https://github.com/panva/jose/blob/v6.0.9/docs/key/export/functions/exportSPKI.md) |
| 63 | + |
| 64 | +### JSON Web Signature (JWS) |
| 65 | + |
| 66 | +The `jose` module supports signing and verification of JWS messages with arbitrary payloads in Compact, Flattened JSON, and General JSON serialization syntaxes. |
| 67 | + |
| 68 | +- Signing - [Compact](https://github.com/panva/jose/blob/v6.0.9/docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jws/general/sign/classes/GeneralSign.md) |
| 69 | +- Verification - [Compact](https://github.com/panva/jose/blob/v6.0.9/docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jws/general/verify/functions/generalVerify.md) |
| 70 | + - [Using a remote JSON Web Key Set (JWKS)](https://github.com/panva/jose/blob/v6.0.9/docs/jwks/remote/functions/createRemoteJWKSet.md) |
| 71 | + - [Using a local JSON Web Key Set (JWKS)](https://github.com/panva/jose/blob/v6.0.9/docs/jwks/local/functions/createLocalJWKSet.md) |
| 72 | +- Utility functions |
| 73 | + - [Decoding Token's Protected Header](https://github.com/panva/jose/blob/v6.0.9/docs/util/decode_protected_header/functions/decodeProtectedHeader.md) |
| 74 | + |
| 75 | +### JSON Web Encryption (JWE) |
| 76 | + |
| 77 | +The `jose` module supports encryption and decryption of JWE messages with arbitrary plaintext in Compact, Flattened JSON, and General JSON serialization syntaxes. |
| 78 | + |
| 79 | +- Encryption - [Compact](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/general/encrypt/classes/GeneralEncrypt.md) |
| 80 | +- Decryption - [Compact](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](https://github.com/panva/jose/blob/v6.0.9/docs/jwe/general/decrypt/functions/generalDecrypt.md) |
| 81 | +- Utility functions |
| 82 | + - [Decoding Token's Protected Header](https://github.com/panva/jose/blob/v6.0.9/docs/util/decode_protected_header/functions/decodeProtectedHeader.md) |
| 83 | + |
| 84 | +### Other |
| 85 | + |
| 86 | +The following are additional features and utilities provided by the `jose` module: |
| 87 | + |
| 88 | +- [Calculating JWK Thumbprint](https://github.com/panva/jose/blob/v6.0.9/docs/jwk/thumbprint/functions/calculateJwkThumbprint.md) |
| 89 | +- [Calculating JWK Thumbprint URI](https://github.com/panva/jose/blob/v6.0.9/docs/jwk/thumbprint/functions/calculateJwkThumbprintUri.md) |
| 90 | +- [Verification using a JWK Embedded in a JWS Header](https://github.com/panva/jose/blob/v6.0.9/docs/jwk/embedded/functions/EmbeddedJWK.md) |
| 91 | +- [Unsecured JWT](https://github.com/panva/jose/blob/v6.0.9/docs/jwt/unsecured/classes/UnsecuredJWT.md) |
| 92 | +- [JOSE Errors](https://github.com/panva/jose/blob/v6.0.9/docs/util/errors/README.md) |
| 93 | + |
| 94 | +[sponsor-auth0]: https://a0.to/signup/panva |
| 95 | + |
| 96 | +[^cjs]: CJS style `let jose = require('jose')` is possible in Node.js versions where `process.features.require_module` is `true` or with the `--experimental-require-module` Node.js CLI flag. |
0 commit comments