docs: correct subpaths and API documentation

Correct subpath names that otherwise lead users to unexported entries,
and fix examples, links, and missing descriptions in published JSDoc.

Use instanceof in JWKS recovery examples so strict TypeScript can
narrow caught errors.

Signed-off-by: Filip Skokan <[email protected]>
This commit is contained in:
Filip Skokan
2026-07-29 18:50:54 +02:00
parent abec502715
commit f7ef7912cd
37 changed files with 212 additions and 105 deletions
@@ -13,7 +13,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **CompactDecryptGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **CompactDecryptGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -29,4 +29,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -65,7 +65,7 @@ Encrypts and resolves the value of the Compact JWE string.
▸ **setContentEncryptionKey**(`cek`): `this`
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.
"enc" (Encryption Algorithm) Header Parameter.
#### Parameters
@@ -89,7 +89,7 @@ You should not use this method. It is only really intended for test and vector
▸ **setInitializationVector**(`iv`): `this`
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
#### Parameters
@@ -13,7 +13,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **FlattenedDecryptGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **FlattenedDecryptGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -29,4 +29,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -16,7 +16,7 @@ const jwe = await new jose.FlattenedEncrypt(
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
.setAdditionalAuthenticatedData(encoder.encode('The Fellowship of the Ring'))
.setAdditionalAuthenticatedData(new TextEncoder().encode('The Fellowship of the Ring'))
.encrypt(publicKey)
console.log(jwe)
@@ -84,7 +84,7 @@ Sets the Additional Authenticated Data on the FlattenedEncrypt object.
▸ **setContentEncryptionKey**(`cek`): `this`
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.
"enc" (Encryption Algorithm) Header Parameter.
#### Parameters
@@ -108,7 +108,7 @@ You should not use this method. It is only really intended for test and vector
▸ **setInitializationVector**(`iv`): `this`
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
#### Parameters
@@ -13,7 +13,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **GeneralDecryptGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **GeneralDecryptGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -29,4 +29,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
+11 -8
View File
@@ -6,25 +6,28 @@ Support from the community to continue maintaining and improving this module is
▸ **EmbeddedJWK**(`protectedHeader?`, `token?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey)\>
EmbeddedJWK is an implementation of a GetKeyFunction intended to be used with the JWS/JWT verify
operations whenever you need to opt-in to verify signatures with a public key embedded in the
token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify
function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header Parameter values.
EmbeddedJWK is an implementation of a [GetKeyFunction](../../../types/interfaces/GetKeyFunction.md) intended to be
used with the JWS/JWT verify operations whenever you need to opt-in to verify signatures with a
public key embedded in the token's "jwk" (JSON Web Key) Header Parameter. It is recommended to
combine this with the verify function's `algorithms` option to define accepted JWS "alg"
(Algorithm) Header Parameter values.
This function is exported (as a named export) from the main `'jose'` module entry point as well
as from its subpath export `'jose/jwk/embedded'`.
## Parameters
| Parameter | Type |
| ------ | ------ |
| `protectedHeader?` | [`JWSHeaderParameters`](../../../types/interfaces/JWSHeaderParameters.md) |
| `token?` | [`FlattenedJWSInput`](../../../types/interfaces/FlattenedJWSInput.md) |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `protectedHeader?` | [`JWSHeaderParameters`](../../../types/interfaces/JWSHeaderParameters.md) | JWS Protected Header. |
| `token?` | [`FlattenedJWSInput`](../../../types/interfaces/FlattenedJWSInput.md) | The consumed JWS token. |
## Returns
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey)\>
The public key from the JWS "jwk" (JSON Web Key) Header Parameter.
## Example
```js
@@ -15,7 +15,7 @@ as from its subpath export `'jose/jwk/thumbprint'`.
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) | Key to calculate the thumbprint for. |
| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) | Key to calculate the thumbprint for. |
| `digestAlgorithm?` | `"sha256"` \| `"sha384"` \| `"sha512"` | Digest Algorithm to use for calculating the thumbprint. Default is "sha256". |
## Returns
@@ -15,7 +15,7 @@ as from its subpath export `'jose/jwk/thumbprint'`.
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) | Key to calculate the thumbprint for. |
| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) | Key to calculate the thumbprint for. |
| `digestAlgorithm?` | `"sha256"` \| `"sha384"` \| `"sha512"` | Digest Algorithm to use for calculating the thumbprint. Default is "sha256". |
## Returns
@@ -74,12 +74,12 @@ const options = {
const { payload, protectedHeader } = await jose
.jwtVerify(jwt, JWKS, options)
.catch(async (error) => {
if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
if (error instanceof jose.errors.JWKSMultipleMatchingKeys) {
for await (const publicKey of error) {
try {
return await jose.jwtVerify(jwt, publicKey, options)
} catch (innerError) {
if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
if (innerError instanceof jose.errors.JWSSignatureVerificationFailed) {
continue
}
throw innerError
@@ -61,12 +61,12 @@ const options = {
const { payload, protectedHeader } = await jose
.jwtVerify(jwt, JWKS, options)
.catch(async (error) => {
if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
if (error instanceof jose.errors.JWKSMultipleMatchingKeys) {
for await (const publicKey of error) {
try {
return await jose.jwtVerify(jwt, publicKey, options)
} catch (innerError) {
if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
if (innerError instanceof jose.errors.JWSSignatureVerificationFailed) {
continue
}
throw innerError
+12
View File
@@ -21,6 +21,9 @@ logging outgoing requests and their responses.
```ts
import ky from 'ky'
// Prerequisites
let url!: URL
let logRequest!: (request: Request) => void
let logResponse!: (request: Request, response: Response) => void
let logRetry!: (request: Request, error: Error, retryCount: number) => void
@@ -55,6 +58,9 @@ Using [nodejs/undici](https://github.com/nodejs/undici) to detect and use HTTP p
```ts
import * as undici from 'undici'
// Prerequisites
let url!: URL
// see https://undici.nodejs.org/api/EnvHttpProxyAgent
let envHttpProxyAgent = new undici.EnvHttpProxyAgent()
@@ -72,6 +78,9 @@ Using [nodejs/undici](https://github.com/nodejs/undici) to automatically retry n
```ts
import * as undici from 'undici'
// Prerequisites
let url!: URL
// see https://undici.nodejs.org/api/RetryAgent
let retryAgent = new undici.RetryAgent(new undici.Agent(), {
statusCodes: [],
@@ -100,6 +109,9 @@ Using [nodejs/undici](https://github.com/nodejs/undici) to mock responses in tes
```ts
import * as undici from 'undici'
// Prerequisites
let url!: URL
// see https://undici.nodejs.org/api/MockAgent
let mockAgent = new undici.MockAgent()
mockAgent.disableNetConnect()
@@ -17,7 +17,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **CompactVerifyGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **CompactVerifyGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -33,4 +33,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -17,7 +17,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **FlattenedVerifyGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **FlattenedVerifyGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -33,4 +33,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -17,7 +17,7 @@ verified at the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **GeneralVerifyGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **GeneralVerifyGetKey**(`protectedHeader`, `token`): [`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -33,4 +33,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -13,7 +13,7 @@ the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **JWTDecryptGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **JWTDecryptGetKey**(`protectedHeader`, `token`): [`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -29,4 +29,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType`\>
+2 -2
View File
@@ -134,7 +134,7 @@ Set the "aud" (Audience) Claim.
▸ **setContentEncryptionKey**(`cek`): `this`
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.
"enc" (Encryption Algorithm) Header Parameter.
#### Parameters
@@ -194,7 +194,7 @@ readability when adding to the current unix timestamp.
▸ **setInitializationVector**(`iv`): `this`
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
#### Parameters
+2 -1
View File
@@ -27,11 +27,12 @@ console.log(unsecuredJwt)
Decoding
```js
const payload = jose.UnsecuredJWT.decode(unsecuredJwt, {
const { payload, header } = jose.UnsecuredJWT.decode(unsecuredJwt, {
issuer: 'urn:example:issuer',
audience: 'urn:example:audience',
})
console.log(header)
console.log(payload)
```
@@ -18,8 +18,12 @@ Result of decoding an Unsecured JWT.
• **header**: [`JWSHeaderParameters`](../../../types/interfaces/JWSHeaderParameters.md)
The decoded JOSE Header; always `{ "alg": "none" }` for an Unsecured JWT.
***
### payload
• **payload**: `PayloadType` & [`JWTPayload`](../../../types/interfaces/JWTPayload.md)
JWT Claims Set.
@@ -17,7 +17,7 @@ the time of this function call.
| ------ | ------ |
| `KeyType` *extends* [`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
▸ **JWTVerifyGetKey**(`protectedHeader`, `token`): [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType`\>
▸ **JWTVerifyGetKey**(`protectedHeader`, `token`): [`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType`\>
Dynamic key resolution function. No token components have been verified at the time of this
function call.
@@ -33,4 +33,4 @@ If a suitable key for the token cannot be matched, throw an error instead.
## Returns
[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/type-aliases/JWK.md) \| `KeyType`\>
[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../types/type-aliases/JWK.md) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| `KeyType`\>
@@ -14,7 +14,7 @@ asymmetric key pairs. For symmetric secrets use the `generateSecret` function.
> [GenerateKeyPairOptions.extractable](../interfaces/GenerateKeyPairOptions.md#extractable) to generate an extractable `privateKey`.
This function is exported (as a named export) from the main `'jose'` module entry point as well
as from its subpath export `'jose/generate/keypair'`.
as from its subpath export `'jose/key/generate/keypair'`.
## Parameters
@@ -16,7 +16,7 @@ Generates a symmetric secret key for a given JWA algorithm identifier.
> [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) this method yields a [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) for them instead.
This function is exported (as a named export) from the main `'jose'` module entry point as well
as from its subpath export `'jose/generate/secret'`.
as from its subpath export `'jose/key/generate/secret'`.
## Type Parameters
+19 -3
View File
@@ -8,12 +8,28 @@ Support from the community to continue maintaining and improving this module is
Decodes a Base64URL encoded input.
These functions are exported (as the `base64url` namespace) from the main `'jose'` module entry
point as well as from its subpath export `'jose/base64url'`.
## Parameters
| Parameter | Type |
| ------ | ------ |
| `input` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `input` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Base64URL encoded input, as a string or its UTF-8 bytes. |
## Returns
[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
The decoded bytes.
## Example
```js
const decoded = jose.base64url.decode('SGVsbG8gV29ybGQh')
```
## Throws
When the input is not correctly Base64URL encoded. Standard Base64 input
(i.e. containing `+` or `/`) is rejected.
+14 -3
View File
@@ -8,12 +8,23 @@ Support from the community to continue maintaining and improving this module is
Encodes an input using Base64URL with no padding.
These functions are exported (as the `base64url` namespace) from the main `'jose'` module entry
point as well as from its subpath export `'jose/base64url'`.
## Parameters
| Parameter | Type |
| ------ | ------ |
| `input` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) |
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `input` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Input to encode, as a string or as bytes. Strings are encoded as UTF-8 first. |
## Returns
`string`
The Base64URL encoded, unpadded, representation of the input.
## Example
```js
const encoded = jose.base64url.encode('Hello World!')
```
+3
View File
@@ -2,6 +2,9 @@
JOSE module errors and error codes
These are exported (as the `errors` namespace) from the main `'jose'` module entry point as well
as from the subpath export `'jose/errors'`.
## Classes
- [JOSEAlgNotAllowed](classes/JOSEAlgNotAllowed.md)
+1 -1
View File
@@ -129,6 +129,6 @@ export type {
* In prior releases this indicated whether a Node.js-specific build was loaded, this is now fixed
* to `"WebCryptoAPI"`
*
* @deprecated
* @deprecated Remove any runtime branching on this value; it is always `"WebCryptoAPI"`.
*/
export const cryptoRuntime = 'WebCryptoAPI'
+2 -2
View File
@@ -39,7 +39,7 @@ export class CompactEncrypt {
/**
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
* enc" (Encryption Algorithm) Header Parameter.
* "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
@@ -53,7 +53,7 @@ export class CompactEncrypt {
/**
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
+3 -3
View File
@@ -30,7 +30,7 @@ import { compress } from '../../lib/deflate.js'
* new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
* )
* .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
* .setAdditionalAuthenticatedData(encoder.encode('The Fellowship of the Ring'))
* .setAdditionalAuthenticatedData(new TextEncoder().encode('The Fellowship of the Ring'))
* .encrypt(publicKey)
*
* console.log(jwe)
@@ -124,7 +124,7 @@ export class FlattenedEncrypt {
/**
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
* enc" (Encryption Algorithm) Header Parameter.
* "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
@@ -139,7 +139,7 @@ export class FlattenedEncrypt {
/**
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
+10 -4
View File
@@ -10,10 +10,11 @@ import { isObject } from '../lib/type_checks.js'
import { JWSInvalid } from '../util/errors.js'
/**
* EmbeddedJWK is an implementation of a GetKeyFunction intended to be used with the JWS/JWT verify
* operations whenever you need to opt-in to verify signatures with a public key embedded in the
* token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify
* function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header Parameter values.
* EmbeddedJWK is an implementation of a {@link types.GetKeyFunction GetKeyFunction} intended to be
* used with the JWS/JWT verify operations whenever you need to opt-in to verify signatures with a
* public key embedded in the token's "jwk" (JSON Web Key) Header Parameter. It is recommended to
* combine this with the verify function's `algorithms` option to define accepted JWS "alg"
* (Algorithm) Header Parameter values.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/jwk/embedded'`.
@@ -32,6 +33,11 @@ import { JWSInvalid } from '../util/errors.js'
* console.log(protectedHeader)
* console.log(payload)
* ```
*
* @param protectedHeader JWS Protected Header.
* @param token The consumed JWS token.
*
* @returns The public key from the JWS "jwk" (JSON Web Key) Header Parameter.
*/
export async function EmbeddedJWK(
protectedHeader?: types.JWSHeaderParameters,
+2 -2
View File
@@ -232,12 +232,12 @@ export interface LocalJWKSet {
* const { payload, protectedHeader } = await jose
* .jwtVerify(jwt, JWKS, options)
* .catch(async (error) => {
* if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
* if (error instanceof jose.errors.JWKSMultipleMatchingKeys) {
* for await (const publicKey of error) {
* try {
* return await jose.jwtVerify(jwt, publicKey, options)
* } catch (innerError) {
* if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
* if (innerError instanceof jose.errors.JWSSignatureVerificationFailed) {
* continue
* }
* throw innerError
+14 -2
View File
@@ -48,6 +48,9 @@ if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozi
* ```ts
* import ky from 'ky'
*
* // Prerequisites
* let url!: URL
*
* let logRequest!: (request: Request) => void
* let logResponse!: (request: Request, response: Response) => void
* let logRetry!: (request: Request, error: Error, retryCount: number) => void
@@ -84,6 +87,9 @@ if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozi
* ```ts
* import * as undici from 'undici'
*
* // Prerequisites
* let url!: URL
*
* // see https://undici.nodejs.org/api/EnvHttpProxyAgent
* let envHttpProxyAgent = new undici.EnvHttpProxyAgent()
*
@@ -103,6 +109,9 @@ if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozi
* ```ts
* import * as undici from 'undici'
*
* // Prerequisites
* let url!: URL
*
* // see https://undici.nodejs.org/api/RetryAgent
* let retryAgent = new undici.RetryAgent(new undici.Agent(), {
* statusCodes: [],
@@ -133,6 +142,9 @@ if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozi
* ```ts
* import * as undici from 'undici'
*
* // Prerequisites
* let url!: URL
*
* // see https://undici.nodejs.org/api/MockAgent
* let mockAgent = new undici.MockAgent()
* mockAgent.disableNetConnect()
@@ -521,12 +533,12 @@ class RemoteJWKSetImpl {
* const { payload, protectedHeader } = await jose
* .jwtVerify(jwt, JWKS, options)
* .catch(async (error) => {
* if (error?.code === 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') {
* if (error instanceof jose.errors.JWKSMultipleMatchingKeys) {
* for await (const publicKey of error) {
* try {
* return await jose.jwtVerify(jwt, publicKey, options)
* } catch (innerError) {
* if (innerError?.code === 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED') {
* if (innerError instanceof jose.errors.JWSSignatureVerificationFailed) {
* continue
* }
* throw innerError
+2 -2
View File
@@ -119,7 +119,7 @@ export class EncryptJWT implements types.ProduceJWT {
/**
* Sets a content encryption key to use, by default a random suitable one is generated for the JWE
* enc" (Encryption Algorithm) Header Parameter.
* "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
@@ -134,7 +134,7 @@ export class EncryptJWT implements types.ProduceJWT {
/**
* Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
* one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
* one is generated for the JWE "enc" (Encryption Algorithm) Header Parameter.
*
* @deprecated You should not use this method. It is only really intended for test and vector
* validation purposes.
+4 -1
View File
@@ -13,10 +13,12 @@ import { validateClaimsSet, JWTClaimsBuilder } from '../lib/jwt_claims_set.js'
/** Result of decoding an Unsecured JWT. */
export interface UnsecuredResult<PayloadType = types.JWTPayload> {
/** JWT Claims Set. */
payload: PayloadType &
types.JWTPayload &
([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never)
/** The decoded JOSE Header; always `{ "alg": "none" }` for an Unsecured JWT. */
header: types.JWSHeaderParameters
}
@@ -46,11 +48,12 @@ export interface UnsecuredResult<PayloadType = types.JWTPayload> {
* Decoding
*
* ```js
* const payload = jose.UnsecuredJWT.decode(unsecuredJwt, {
* const { payload, header } = jose.UnsecuredJWT.decode(unsecuredJwt, {
* issuer: 'urn:example:issuer',
* audience: 'urn:example:audience',
* })
*
* console.log(header)
* console.log(payload)
* ```
*/
+1 -1
View File
@@ -98,7 +98,7 @@ function getModulusLengthOption(options?: GenerateKeyPairOptions) {
* > {@link GenerateKeyPairOptions.extractable} to generate an extractable `privateKey`.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/generate/keypair'`.
* as from its subpath export `'jose/key/generate/keypair'`.
*
* @example
*
+1 -1
View File
@@ -71,7 +71,7 @@ export interface GenerateSecretOptions {
* > {@link !CryptoKey} this method yields a {@link !Uint8Array} for them instead.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/generate/secret'`.
* as from its subpath export `'jose/key/generate/secret'`.
*
* @example
*
+38 -38
View File
@@ -114,13 +114,6 @@ export type JWKParameters = {
kid?: string
}
/**
* Key or secret input accepted by all sign, verify, encrypt, and decrypt operations.
*
* @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
*/
export type KeyInput = CryptoKey | KeyObject | JWK | Uint8Array
/** Convenience interface for Public OKP JSON Web Keys */
export interface JWK_OKP_Public extends JWKParameters {
/** OKP JWK "crv" (The Subtype of Key Pair) Parameter */
@@ -195,37 +188,6 @@ export interface JWK_oct extends JWKParameters {
k: string
}
/**
* Discriminated union of the JSON Web Key shapes supported by this module. Unlike {@link JWK}, this
* can be narrowed on the "kty" (Key Type) Parameter.
*
* Each member is the convenience interface for one key type with its "kty" (Key Type) Parameter
* required and fixed to that key type, rather than optional as the interface alone leaves it.
*
* @example
*
* ```ts
* let jwk!: jose.AnyJWK
*
* if (jwk.kty === 'EC') {
* console.log(jwk.crv, jwk.x, jwk.y)
* }
* ```
*/
// The "kty" is intersected into each arm one at a time rather than distributed over a parenthesised
// union - `X & (A | B)` means the same thing, but typedoc renders it without the parentheses, which
// reads as though the second arm carried no "kty" at all.
export type AnyJWK =
| (JWK_EC_Private & { kty: 'EC' })
| (JWK_EC_Public & { kty: 'EC' })
| (JWK_RSA_Private & { kty: 'RSA' })
| (JWK_RSA_Public & { kty: 'RSA' })
| (JWK_OKP_Private & { kty: 'OKP' })
| (JWK_OKP_Public & { kty: 'OKP' })
| (JWK_AKP_Private & { kty: 'AKP' })
| (JWK_AKP_Public & { kty: 'AKP' })
| (JWK_oct & { kty: 'oct' })
/**
* JSON Web Key ({@link https://www.rfc-editor.org/info/rfc7517/ JWK}). "RSA", "EC", "OKP", "AKP",
* and "oct" key types are supported.
@@ -326,6 +288,44 @@ export type JWK = {
}>
}
/**
* Discriminated union of the JSON Web Key shapes supported by this module. Unlike {@link JWK}, this
* can be narrowed on the "kty" (Key Type) Parameter.
*
* Each member is the convenience interface for one key type with its "kty" (Key Type) Parameter
* required and fixed to that key type, rather than optional as the interface alone leaves it.
*
* @example
*
* ```ts
* let jwk!: jose.AnyJWK
*
* if (jwk.kty === 'EC') {
* console.log(jwk.crv, jwk.x, jwk.y)
* }
* ```
*/
// The "kty" is intersected into each arm one at a time rather than distributed over a parenthesised
// union - `X & (A | B)` means the same thing, but typedoc renders it without the parentheses, which
// reads as though the second arm carried no "kty" at all.
export type AnyJWK =
| (JWK_EC_Private & { kty: 'EC' })
| (JWK_EC_Public & { kty: 'EC' })
| (JWK_RSA_Private & { kty: 'RSA' })
| (JWK_RSA_Public & { kty: 'RSA' })
| (JWK_OKP_Private & { kty: 'OKP' })
| (JWK_OKP_Public & { kty: 'OKP' })
| (JWK_AKP_Private & { kty: 'AKP' })
| (JWK_AKP_Public & { kty: 'AKP' })
| (JWK_oct & { kty: 'oct' })
/**
* Key or secret input accepted by all sign, verify, encrypt, and decrypt operations.
*
* @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
*/
export type KeyInput = CryptoKey | KeyObject | JWK | Uint8Array
/**
* @private
*
+35 -2
View File
@@ -7,7 +7,25 @@
import { encoder, decoder } from '../lib/buffer_utils.js'
import { encodeBase64, decodeBase64 } from '../lib/base64.js'
/** Decodes a Base64URL encoded input. */
/**
* Decodes a Base64URL encoded input.
*
* These functions are exported (as the `base64url` namespace) from the main `'jose'` module entry
* point as well as from its subpath export `'jose/base64url'`.
*
* @example
*
* ```js
* const decoded = jose.base64url.decode('SGVsbG8gV29ybGQh')
* ```
*
* @param input Base64URL encoded input, as a string or its UTF-8 bytes.
*
* @returns The decoded bytes.
*
* @throws {!TypeError} When the input is not correctly Base64URL encoded. Standard Base64 input
* (i.e. containing `+` or `/`) is rejected.
*/
export function decode(input: Uint8Array | string): Uint8Array {
// @ts-ignore
if (Uint8Array.fromBase64) {
@@ -37,7 +55,22 @@ export function decode(input: Uint8Array | string): Uint8Array {
}
}
/** Encodes an input using Base64URL with no padding. */
/**
* Encodes an input using Base64URL with no padding.
*
* These functions are exported (as the `base64url` namespace) from the main `'jose'` module entry
* point as well as from its subpath export `'jose/base64url'`.
*
* @example
*
* ```js
* const encoded = jose.base64url.encode('Hello World!')
* ```
*
* @param input Input to encode, as a string or as bytes. Strings are encoded as UTF-8 first.
*
* @returns The Base64URL encoded, unpadded, representation of the input.
*/
export function encode(input: Uint8Array | string): string {
let unencoded = input
if (typeof unencoded === 'string') {
+3
View File
@@ -1,6 +1,9 @@
/**
* JOSE module errors and error codes
*
* These are exported (as the `errors` namespace) from the main `'jose'` module entry point as well
* as from the subpath export `'jose/errors'`.
*
* @module
*/