diff --git a/docs/jwe/compact/decrypt/functions/compactDecrypt.md b/docs/jwe/compact/decrypt/functions/compactDecrypt.md index 277ab32104..4b825f8b96 100644 --- a/docs/jwe/compact/decrypt/functions/compactDecrypt.md +++ b/docs/jwe/compact/decrypt/functions/compactDecrypt.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jwe/compact/decrypt'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jwe` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Compact JWE. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`DecryptOptions`](../../../../types/interfaces/DecryptOptions.md) | JWE Decryption options. | ### Returns @@ -39,13 +39,7 @@ console.log(new TextDecoder().decode(plaintext)) ## Call Signature -▸ **compactDecrypt**\<`KeyLikeType`\>(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactDecryptResult`](../../../../types/interfaces/CompactDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **compactDecrypt**(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactDecryptResult`](../../../../types/interfaces/CompactDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -57,4 +51,4 @@ console.log(new TextDecoder().decode(plaintext)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactDecryptResult`](../../../../types/interfaces/CompactDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactDecryptResult`](../../../../types/interfaces/CompactDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jwe/compact/decrypt/interfaces/CompactDecryptGetKey.md b/docs/jwe/compact/decrypt/interfaces/CompactDecryptGetKey.md index d0101f4cba..e0a91c94e0 100644 --- a/docs/jwe/compact/decrypt/interfaces/CompactDecryptGetKey.md +++ b/docs/jwe/compact/decrypt/interfaces/CompactDecryptGetKey.md @@ -7,7 +7,7 @@ Support from the community to continue maintaining and improving this module is Interface for Compact JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. -▸ **CompactDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +▸ **CompactDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for Compact JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. @@ -21,4 +21,4 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> diff --git a/docs/jwe/compact/encrypt/classes/CompactEncrypt.md b/docs/jwe/compact/encrypt/classes/CompactEncrypt.md index e938bb05f4..73806c9d4e 100644 --- a/docs/jwe/compact/encrypt/classes/CompactEncrypt.md +++ b/docs/jwe/compact/encrypt/classes/CompactEncrypt.md @@ -49,7 +49,7 @@ Encrypts and resolves the value of the Compact JWE string. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Public Key or Secret to encrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Public Key or Secret to encrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`EncryptOptions`](../../../../types/interfaces/EncryptOptions.md) | JWE Encryption options. | #### Returns diff --git a/docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md b/docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md index 8a86ca9ed9..150363c2c2 100644 --- a/docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md +++ b/docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jwe/flattened/decrypt'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jwe` | [`FlattenedJWE`](../../../../types/interfaces/FlattenedJWE.md) | Flattened JWE. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`DecryptOptions`](../../../../types/interfaces/DecryptOptions.md) | JWE Decryption options. | ### Returns @@ -49,13 +49,7 @@ console.log(decoder.decode(additionalAuthenticatedData)) ## Call Signature -▸ **flattenedDecrypt**\<`KeyLikeType`\>(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedDecryptResult`](../../../../types/interfaces/FlattenedDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **flattenedDecrypt**(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedDecryptResult`](../../../../types/interfaces/FlattenedDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -67,4 +61,4 @@ console.log(decoder.decode(additionalAuthenticatedData)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedDecryptResult`](../../../../types/interfaces/FlattenedDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedDecryptResult`](../../../../types/interfaces/FlattenedDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jwe/flattened/decrypt/interfaces/FlattenedDecryptGetKey.md b/docs/jwe/flattened/decrypt/interfaces/FlattenedDecryptGetKey.md index b103412bbb..0cdd13e2b7 100644 --- a/docs/jwe/flattened/decrypt/interfaces/FlattenedDecryptGetKey.md +++ b/docs/jwe/flattened/decrypt/interfaces/FlattenedDecryptGetKey.md @@ -7,7 +7,7 @@ Support from the community to continue maintaining and improving this module is Interface for Flattened JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. -▸ **FlattenedDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +▸ **FlattenedDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for Flattened JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. @@ -21,4 +21,4 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> diff --git a/docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md b/docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md index 75b70010b0..d425a8b6bf 100644 --- a/docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md +++ b/docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md @@ -50,7 +50,7 @@ Encrypts and resolves the value of the Flattened JWE object. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Public Key or Secret to encrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Public Key or Secret to encrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`EncryptOptions`](../../../../types/interfaces/EncryptOptions.md) | JWE Encryption options. | #### Returns diff --git a/docs/jwe/general/decrypt/functions/generalDecrypt.md b/docs/jwe/general/decrypt/functions/generalDecrypt.md index 03e07874da..e4cb2ce597 100644 --- a/docs/jwe/general/decrypt/functions/generalDecrypt.md +++ b/docs/jwe/general/decrypt/functions/generalDecrypt.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jwe/general/decrypt'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jwe` | [`GeneralJWE`](../../../../types/interfaces/GeneralJWE.md) | General JWE. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to decrypt the JWE with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`DecryptOptions`](../../../../types/interfaces/DecryptOptions.md) | JWE Decryption options. | ### Returns @@ -53,13 +53,7 @@ console.log(decoder.decode(additionalAuthenticatedData)) ## Call Signature -▸ **generalDecrypt**\<`KeyLikeType`\>(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralDecryptResult`](../../../../types/interfaces/GeneralDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **generalDecrypt**(`jwe`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralDecryptResult`](../../../../types/interfaces/GeneralDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -71,4 +65,4 @@ console.log(decoder.decode(additionalAuthenticatedData)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralDecryptResult`](../../../../types/interfaces/GeneralDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralDecryptResult`](../../../../types/interfaces/GeneralDecryptResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jwe/general/decrypt/interfaces/GeneralDecryptGetKey.md b/docs/jwe/general/decrypt/interfaces/GeneralDecryptGetKey.md index 2b8c835728..b2036d3e02 100644 --- a/docs/jwe/general/decrypt/interfaces/GeneralDecryptGetKey.md +++ b/docs/jwe/general/decrypt/interfaces/GeneralDecryptGetKey.md @@ -7,7 +7,7 @@ Support from the community to continue maintaining and improving this module is Interface for General JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. -▸ **GeneralDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +▸ **GeneralDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for General JWE Decryption dynamic key resolution. No token components have been verified at the time of this function call. @@ -21,4 +21,4 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> diff --git a/docs/jwe/general/encrypt/classes/GeneralEncrypt.md b/docs/jwe/general/encrypt/classes/GeneralEncrypt.md index a6df4202f2..771bdfe1e8 100644 --- a/docs/jwe/general/encrypt/classes/GeneralEncrypt.md +++ b/docs/jwe/general/encrypt/classes/GeneralEncrypt.md @@ -53,7 +53,7 @@ Adds an additional recipient for the General JWE object. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | Public Key or Secret to encrypt the Content Encryption Key for the recipient with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Public Key or Secret to encrypt the Content Encryption Key for the recipient with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`CritOption`](../../../../types/interfaces/CritOption.md) | JWE Encryption options. | #### Returns diff --git a/docs/jwe/general/encrypt/interfaces/Recipient.md b/docs/jwe/general/encrypt/interfaces/Recipient.md index 2081460e01..849c6fd7f3 100644 --- a/docs/jwe/general/encrypt/interfaces/Recipient.md +++ b/docs/jwe/general/encrypt/interfaces/Recipient.md @@ -16,7 +16,7 @@ A shorthand for calling addRecipient() on the enclosing GeneralEncrypt instance | Parameter | Type | | ------ | ------ | -| ...`args` | [[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md), [`CritOption`](../../../../types/interfaces/CritOption.md)] | +| ...`args` | [[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md), [`CritOption`](../../../../types/interfaces/CritOption.md)] | #### Returns diff --git a/docs/jwk/embedded/functions/EmbeddedJWK.md b/docs/jwk/embedded/functions/EmbeddedJWK.md index 120eae8042..e09459894e 100644 --- a/docs/jwk/embedded/functions/EmbeddedJWK.md +++ b/docs/jwk/embedded/functions/EmbeddedJWK.md @@ -4,7 +4,7 @@ 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). -▸ **EmbeddedJWK**\<`KeyLikeType`\>(`protectedHeader`?, `token`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **EmbeddedJWK**(`protectedHeader`?, `token`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> 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 @@ -14,12 +14,6 @@ function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header P 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'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | @@ -29,7 +23,7 @@ as from its subpath export `'jose/jwk/embedded'`. ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> ## Example diff --git a/docs/jwks/local/functions/createLocalJWKSet.md b/docs/jwks/local/functions/createLocalJWKSet.md index 64b8cdb947..77d83c6b42 100644 --- a/docs/jwks/local/functions/createLocalJWKSet.md +++ b/docs/jwks/local/functions/createLocalJWKSet.md @@ -4,7 +4,7 @@ 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). -▸ **createLocalJWKSet**\<`KeyLikeType`\>(`jwks`): (`protectedHeader`?, `token`?) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **createLocalJWKSet**(`jwks`): (`protectedHeader`?, `token`?) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> Returns a function that resolves a JWS JOSE Header to a public key object from a locally stored, or otherwise available, JSON Web Key Set. @@ -24,12 +24,6 @@ work for public encryption keys. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/jwks/local'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | @@ -49,7 +43,7 @@ as from its subpath export `'jose/jwks/local'`. ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> ## Examples diff --git a/docs/jwks/remote/README.md b/docs/jwks/remote/README.md index 5a9db6849b..4785067229 100644 --- a/docs/jwks/remote/README.md +++ b/docs/jwks/remote/README.md @@ -13,8 +13,10 @@ ### Type Aliases +- [FetchImplementation](type-aliases/FetchImplementation.md) - [JWKSCacheInput](type-aliases/JWKSCacheInput.md) ### Variables +- [customFetch](variables/customFetch.md) - [jwksCache](variables/jwksCache.md) diff --git a/docs/jwks/remote/functions/createRemoteJWKSet.md b/docs/jwks/remote/functions/createRemoteJWKSet.md index 0c288ea6c7..c58e504922 100644 --- a/docs/jwks/remote/functions/createRemoteJWKSet.md +++ b/docs/jwks/remote/functions/createRemoteJWKSet.md @@ -4,7 +4,7 @@ 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). -▸ **createRemoteJWKSet**\<`KeyLikeType`\>(`url`, `options`?): (`protectedHeader`?, `token`?) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **createRemoteJWKSet**(`url`, `options`?): (`protectedHeader`?, `token`?) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey)\> Returns a function that resolves a JWS JOSE Header to a public key object downloaded from a remote endpoint returning a JSON Web Key Set, that is, for example, an OAuth 2.0 or OIDC @@ -26,12 +26,6 @@ work for public encryption keys. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/jwks/remote'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | @@ -52,7 +46,7 @@ as from its subpath export `'jose/jwks/remote'`. ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey)\> ## Examples diff --git a/docs/jwks/remote/interfaces/RemoteJWKSetOptions.md b/docs/jwks/remote/interfaces/RemoteJWKSetOptions.md index 8449d38acc..b6c4b0d28e 100644 --- a/docs/jwks/remote/interfaces/RemoteJWKSetOptions.md +++ b/docs/jwks/remote/interfaces/RemoteJWKSetOptions.md @@ -8,24 +8,19 @@ Options for the remote JSON Web Key Set. ## Properties -### \[jwksCache\]? +### \[customFetch\]? -• `optional` **\[jwksCache\]**: [`JWKSCacheInput`](../type-aliases/JWKSCacheInput.md) +• `optional` **\[customFetch\]**: [`FetchImplementation`](../type-aliases/FetchImplementation.md) -See [jwksCache](../variables/jwksCache.md). +See [customFetch](../variables/customFetch.md). *** -### agent? +### \[jwksCache\]? -• `optional` **agent**: `any` +• `optional` **\[jwksCache\]**: [`JWKSCacheInput`](../type-aliases/JWKSCacheInput.md) -An instance of [http.Agent](https://nodejs.org/api/http.html#class-httpagent) or -[https.Agent](https://nodejs.org/api/https.html#class-httpsagent) to pass to the -[http.get](https://nodejs.org/api/http.html#httpgetoptions-callback) or -[https.get](https://nodejs.org/api/https.html#httpsgetoptions-callback) method's options. -Use when behind an http(s) proxy. This is a Node.js runtime specific option, it is ignored when -used outside of Node.js runtime. +See [jwksCache](../variables/jwksCache.md). *** @@ -51,9 +46,7 @@ successful fetch. Default is 30000 (30 seconds). • `optional` **headers**: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `string`\> -Headers to be sent with the HTTP request. Default is that `User-Agent: jose/v${version}` header -is added unless the runtime is a browser in which adding an explicit headers fetch -configuration would cause an unnecessary CORS preflight request. +Headers to be sent with the HTTP request. *** diff --git a/docs/jwks/remote/type-aliases/FetchImplementation.md b/docs/jwks/remote/type-aliases/FetchImplementation.md new file mode 100644 index 0000000000..7b8dbfd0f7 --- /dev/null +++ b/docs/jwks/remote/type-aliases/FetchImplementation.md @@ -0,0 +1,22 @@ +# Type Alias: FetchImplementation() + +## [💗 Help the project](https://github.com/sponsors/panva) + +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). + +• **FetchImplementation**: (`url`, `options`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Response`](https://developer.mozilla.org/docs/Web/API/Response)\> + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | +| `options` | \{`headers`: [`Headers`](https://developer.mozilla.org/docs/Web/API/Headers);`method`: `"GET"`;`redirect`: `"manual"`;`signal`: [`AbortSignal`](https://developer.mozilla.org/docs/Web/API/AbortSignal); \} | +| `options.headers` | [`Headers`](https://developer.mozilla.org/docs/Web/API/Headers) | +| `options.method` | `"GET"` | +| `options.redirect` | `"manual"` | +| `options.signal` | [`AbortSignal`](https://developer.mozilla.org/docs/Web/API/AbortSignal) | + +## Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Response`](https://developer.mozilla.org/docs/Web/API/Response)\> diff --git a/docs/jwks/remote/variables/customFetch.md b/docs/jwks/remote/variables/customFetch.md new file mode 100644 index 0000000000..119816d570 --- /dev/null +++ b/docs/jwks/remote/variables/customFetch.md @@ -0,0 +1,110 @@ +# Variable: customFetch + +## [💗 Help the project](https://github.com/sponsors/panva) + +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). + +• `const` **customFetch**: unique `symbol` + +When passed to [createRemoteJWKSet](../functions/createRemoteJWKSet.md) this allows the resolver +to make use of advanced fetch configurations, HTTP Proxies, retry on network errors, etc. + +## Examples + +Using [sindresorhus/ky](https://github.com/sindresorhus/ky) for retries and its hooks feature for +logging outgoing requests and their responses. + +```ts +import ky from 'ky' + +let logRequest!: (request: Request) => void +let logResponse!: (request: Request, response: Response) => void +let logRetry!: (request: Request, error: Error, retryCount: number) => void + +const JWKS = jose.createRemoteJWKSet(url, { + [jose.customFetch]: (...args) => + ky(args[0], { + ...args[1], + hooks: { + beforeRequest: [ + (request) => { + logRequest(request) + }, + ], + beforeRetry: [ + ({ request, error, retryCount }) => { + logRetry(request, error, retryCount) + }, + ], + afterResponse: [ + (request, _, response) => { + logResponse(request, response) + }, + ], + }, + }), +}) +``` + +Using [nodejs/undici](https://github.com/nodejs/undici) to detect and use HTTP proxies. + +```ts +import * as undici from 'undici' + +// see https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent +let envHttpProxyAgent = new undici.EnvHttpProxyAgent() + +// @ts-ignore +const JWKS = jose.createRemoteJWKSet(url, { + [jose.customFetch]: (...args) => { + // @ts-ignore + return undici.fetch(args[0], { ...args[1], dispatcher: envHttpProxyAgent }) // prettier-ignore + }, +}) +``` + +Using [nodejs/undici](https://github.com/nodejs/undici) to automatically retry network errors. + +```ts +import * as undici from 'undici' + +// see https://undici.nodejs.org/#/docs/api/RetryAgent +let retryAgent = new undici.RetryAgent(new undici.Agent(), { + statusCodes: [], + errorCodes: [ + 'ECONNRESET', + 'ECONNREFUSED', + 'ENOTFOUND', + 'ENETDOWN', + 'ENETUNREACH', + 'EHOSTDOWN', + 'UND_ERR_SOCKET', + ], +}) + +// @ts-ignore +const JWKS = jose.createRemoteJWKSet(url, { + [jose.customFetch]: (...args) => { + // @ts-ignore + return undici.fetch(args[0], { ...args[1], dispatcher: retryAgent }) // prettier-ignore + }, +}) +``` + +Using [nodejs/undici](https://github.com/nodejs/undici) to mock responses in tests. + +```ts +import * as undici from 'undici' + +// see https://undici.nodejs.org/#/docs/api/MockAgent +let mockAgent = new undici.MockAgent() +mockAgent.disableNetConnect() + +// @ts-ignore +const JWKS = jose.createRemoteJWKSet(url, { + [jose.customFetch]: (...args) => { + // @ts-ignore + return undici.fetch(args[0], { ...args[1], dispatcher: mockAgent }) // prettier-ignore + }, +}) +``` diff --git a/docs/jws/compact/sign/classes/CompactSign.md b/docs/jws/compact/sign/classes/CompactSign.md index d5a9daf0ed..4a54ddbae5 100644 --- a/docs/jws/compact/sign/classes/CompactSign.md +++ b/docs/jws/compact/sign/classes/CompactSign.md @@ -67,7 +67,7 @@ Signs and resolves the value of the Compact JWS string. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`SignOptions`](../../../../types/interfaces/SignOptions.md) | JWS Sign options. | #### Returns diff --git a/docs/jws/compact/verify/functions/compactVerify.md b/docs/jws/compact/verify/functions/compactVerify.md index 35f18c3576..eeac3ec14d 100644 --- a/docs/jws/compact/verify/functions/compactVerify.md +++ b/docs/jws/compact/verify/functions/compactVerify.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jws/compact/verify'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jws` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Compact JWS. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`VerifyOptions`](../../../../types/interfaces/VerifyOptions.md) | JWS Verify options. | ### Returns @@ -39,13 +39,7 @@ console.log(new TextDecoder().decode(payload)) ## Call Signature -▸ **compactVerify**\<`KeyLikeType`\>(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactVerifyResult`](../../../../types/interfaces/CompactVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **compactVerify**(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactVerifyResult`](../../../../types/interfaces/CompactVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -57,4 +51,4 @@ console.log(new TextDecoder().decode(payload)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactVerifyResult`](../../../../types/interfaces/CompactVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CompactVerifyResult`](../../../../types/interfaces/CompactVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jws/compact/verify/interfaces/CompactVerifyGetKey.md b/docs/jws/compact/verify/interfaces/CompactVerifyGetKey.md index 2719307175..8c11808c18 100644 --- a/docs/jws/compact/verify/interfaces/CompactVerifyGetKey.md +++ b/docs/jws/compact/verify/interfaces/CompactVerifyGetKey.md @@ -11,7 +11,7 @@ verified at the time of this function call. [createRemoteJWKSet](../../../../jwks/remote/functions/createRemoteJWKSet.md) to verify using a remote JSON Web Key Set. -▸ **CompactVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +▸ **CompactVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for Compact JWS Verification dynamic key resolution. No token components have been verified at the time of this function call. @@ -25,7 +25,7 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> ## See diff --git a/docs/jws/flattened/sign/classes/FlattenedSign.md b/docs/jws/flattened/sign/classes/FlattenedSign.md index 4595897293..1051db9cda 100644 --- a/docs/jws/flattened/sign/classes/FlattenedSign.md +++ b/docs/jws/flattened/sign/classes/FlattenedSign.md @@ -85,7 +85,7 @@ Signs and resolves the value of the Flattened JWS object. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`SignOptions`](../../../../types/interfaces/SignOptions.md) | JWS Sign options. | #### Returns diff --git a/docs/jws/flattened/verify/functions/flattenedVerify.md b/docs/jws/flattened/verify/functions/flattenedVerify.md index dfa1e77c30..3740a2b75d 100644 --- a/docs/jws/flattened/verify/functions/flattenedVerify.md +++ b/docs/jws/flattened/verify/functions/flattenedVerify.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jws/flattened/verify'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jws` | [`FlattenedJWSInput`](../../../../types/interfaces/FlattenedJWSInput.md) | Flattened JWS. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`VerifyOptions`](../../../../types/interfaces/VerifyOptions.md) | JWS Verify options. | ### Returns @@ -44,13 +44,7 @@ console.log(decoder.decode(payload)) ## Call Signature -▸ **flattenedVerify**\<`KeyLikeType`\>(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedVerifyResult`](../../../../types/interfaces/FlattenedVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **flattenedVerify**(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedVerifyResult`](../../../../types/interfaces/FlattenedVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -62,4 +56,4 @@ console.log(decoder.decode(payload)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedVerifyResult`](../../../../types/interfaces/FlattenedVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`FlattenedVerifyResult`](../../../../types/interfaces/FlattenedVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jws/flattened/verify/interfaces/FlattenedVerifyGetKey.md b/docs/jws/flattened/verify/interfaces/FlattenedVerifyGetKey.md index 4943c05219..b0727e7f21 100644 --- a/docs/jws/flattened/verify/interfaces/FlattenedVerifyGetKey.md +++ b/docs/jws/flattened/verify/interfaces/FlattenedVerifyGetKey.md @@ -11,7 +11,7 @@ verified at the time of this function call. [createRemoteJWKSet](../../../../jwks/remote/functions/createRemoteJWKSet.md) to verify using a remote JSON Web Key Set. -▸ **FlattenedVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +▸ **FlattenedVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for Flattened JWS Verification dynamic key resolution. No token components have been verified at the time of this function call. @@ -25,7 +25,7 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> ## See diff --git a/docs/jws/general/sign/classes/GeneralSign.md b/docs/jws/general/sign/classes/GeneralSign.md index 501d43177c..2e6a7c55c0 100644 --- a/docs/jws/general/sign/classes/GeneralSign.md +++ b/docs/jws/general/sign/classes/GeneralSign.md @@ -52,7 +52,7 @@ Adds an additional signature for the General JWS object. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the individual JWS signature with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Private Key or Secret to sign the individual JWS signature with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`SignOptions`](../../../../types/interfaces/SignOptions.md) | JWS Sign options. | #### Returns diff --git a/docs/jws/general/sign/interfaces/Signature.md b/docs/jws/general/sign/interfaces/Signature.md index 9057c73f1a..54975f1f7e 100644 --- a/docs/jws/general/sign/interfaces/Signature.md +++ b/docs/jws/general/sign/interfaces/Signature.md @@ -16,7 +16,7 @@ A shorthand for calling addSignature() on the enclosing GeneralSign instance | Parameter | Type | | ------ | ------ | -| ...`args` | [[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md), [`SignOptions`](../../../../types/interfaces/SignOptions.md)] | +| ...`args` | [[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md), [`SignOptions`](../../../../types/interfaces/SignOptions.md)] | #### Returns diff --git a/docs/jws/general/verify/functions/generalVerify.md b/docs/jws/general/verify/functions/generalVerify.md index f7233ff39c..3ccb2a04e9 100644 --- a/docs/jws/general/verify/functions/generalVerify.md +++ b/docs/jws/general/verify/functions/generalVerify.md @@ -18,7 +18,7 @@ as from its subpath export `'jose/jws/general/verify'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jws` | [`GeneralJWSInput`](../../../../types/interfaces/GeneralJWSInput.md) | General JWS. | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) | Key to verify the JWS with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`VerifyOptions`](../../../../types/interfaces/VerifyOptions.md) | JWS Verify options. | ### Returns @@ -47,13 +47,7 @@ console.log(new TextDecoder().decode(payload)) ## Call Signature -▸ **generalVerify**\<`KeyLikeType`\>(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralVerifyResult`](../../../../types/interfaces/GeneralVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> - -### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../../types/type-aliases/KeyLike.md) | +▸ **generalVerify**(`jws`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralVerifyResult`](../../../../types/interfaces/GeneralVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> ### Parameters @@ -65,4 +59,4 @@ console.log(new TextDecoder().decode(payload)) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralVerifyResult`](../../../../types/interfaces/GeneralVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GeneralVerifyResult`](../../../../types/interfaces/GeneralVerifyResult.md) & [`ResolvedKey`](../../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jws/general/verify/interfaces/GeneralVerifyGetKey.md b/docs/jws/general/verify/interfaces/GeneralVerifyGetKey.md index d76256d1d4..f8de019f82 100644 --- a/docs/jws/general/verify/interfaces/GeneralVerifyGetKey.md +++ b/docs/jws/general/verify/interfaces/GeneralVerifyGetKey.md @@ -11,7 +11,7 @@ verified at the time of this function call. [createRemoteJWKSet](../../../../jwks/remote/functions/createRemoteJWKSet.md) to verify using a remote JSON Web Key Set. -▸ **GeneralVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +▸ **GeneralVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> Interface for General JWS Verification dynamic key resolution. No token components have been verified at the time of this function call. @@ -25,7 +25,7 @@ verified at the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../../types/interfaces/JWK.md)\> ## See diff --git a/docs/jwt/decrypt/functions/jwtDecrypt.md b/docs/jwt/decrypt/functions/jwtDecrypt.md index 1512ea0f4a..4faacff9df 100644 --- a/docs/jwt/decrypt/functions/jwtDecrypt.md +++ b/docs/jwt/decrypt/functions/jwtDecrypt.md @@ -25,7 +25,7 @@ as from its subpath export `'jose/jwt/decrypt'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jwt` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | JSON Web Token value (encoded as JWE). | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) | Private Key or Secret to decrypt and verify the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Private Key or Secret to decrypt and verify the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`JWTDecryptOptions`](../interfaces/JWTDecryptOptions.md) | JWT Decryption and JWT Claims Set validation options. | ### Returns @@ -50,14 +50,13 @@ console.log(payload) ## Call Signature -▸ **jwtDecrypt**\<`PayloadType`, `KeyLikeType`\>(`jwt`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTDecryptResult`](../../../types/interfaces/JWTDecryptResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +▸ **jwtDecrypt**\<`PayloadType`\>(`jwt`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTDecryptResult`](../../../types/interfaces/JWTDecryptResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\> ### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `PayloadType` | [`JWTPayload`](../../../types/interfaces/JWTPayload.md) | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | ### Parameters @@ -69,4 +68,4 @@ console.log(payload) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTDecryptResult`](../../../types/interfaces/JWTDecryptResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTDecryptResult`](../../../types/interfaces/JWTDecryptResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\> diff --git a/docs/jwt/decrypt/interfaces/JWTDecryptGetKey.md b/docs/jwt/decrypt/interfaces/JWTDecryptGetKey.md index 70dfdaa77a..0b13903194 100644 --- a/docs/jwt/decrypt/interfaces/JWTDecryptGetKey.md +++ b/docs/jwt/decrypt/interfaces/JWTDecryptGetKey.md @@ -7,7 +7,7 @@ Support from the community to continue maintaining and improving this module is Interface for JWT Decryption dynamic key resolution. No token components have been verified at the time of this function call. -▸ **JWTDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md)\> +▸ **JWTDecryptGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> Interface for JWT Decryption dynamic key resolution. No token components have been verified at the time of this function call. @@ -21,4 +21,4 @@ the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> diff --git a/docs/jwt/encrypt/classes/EncryptJWT.md b/docs/jwt/encrypt/classes/EncryptJWT.md index 6dea319617..1aa7072417 100644 --- a/docs/jwt/encrypt/classes/EncryptJWT.md +++ b/docs/jwt/encrypt/classes/EncryptJWT.md @@ -52,7 +52,7 @@ Encrypts and returns the JWT. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) | Public Key or Secret to encrypt the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Public Key or Secret to encrypt the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jwe-alg). | | `options`? | [`EncryptOptions`](../../../types/interfaces/EncryptOptions.md) | JWE Encryption options. | #### Returns diff --git a/docs/jwt/sign/classes/SignJWT.md b/docs/jwt/sign/classes/SignJWT.md index 781855df9d..fa8b9d6a6d 100644 --- a/docs/jwt/sign/classes/SignJWT.md +++ b/docs/jwt/sign/classes/SignJWT.md @@ -330,7 +330,7 @@ Signs and returns the JWT. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Private Key or Secret to sign the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`SignOptions`](../../../types/interfaces/SignOptions.md) | JWT Sign options. | #### Returns diff --git a/docs/jwt/verify/functions/jwtVerify.md b/docs/jwt/verify/functions/jwtVerify.md index b43c7115eb..68fe2b1632 100644 --- a/docs/jwt/verify/functions/jwtVerify.md +++ b/docs/jwt/verify/functions/jwtVerify.md @@ -25,7 +25,7 @@ as from its subpath export `'jose/jwt/verify'`. | Parameter | Type | Description | | ------ | ------ | ------ | | `jwt` | `string` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | JSON Web Token value (encoded as JWS). | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Key to verify the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) | Key to verify the JWT with. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210#jws-alg). | | `options`? | [`JWTVerifyOptions`](../interfaces/JWTVerifyOptions.md) | JWT Decryption and JWT Claims Set validation options. | ### Returns @@ -102,14 +102,13 @@ console.log(payload) ## Call Signature -▸ **jwtVerify**\<`PayloadType`, `KeyLikeType`\>(`jwt`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTVerifyResult`](../../../types/interfaces/JWTVerifyResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +▸ **jwtVerify**\<`PayloadType`\>(`jwt`, `getKey`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTVerifyResult`](../../../types/interfaces/JWTVerifyResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\> ### Type Parameters | Type Parameter | Default type | | ------ | ------ | | `PayloadType` | [`JWTPayload`](../../../types/interfaces/JWTPayload.md) | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | ### Parameters @@ -121,7 +120,7 @@ console.log(payload) ### Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTVerifyResult`](../../../types/interfaces/JWTVerifyResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWTVerifyResult`](../../../types/interfaces/JWTVerifyResult.md)\<`PayloadType`\> & [`ResolvedKey`](../../../types/interfaces/ResolvedKey.md)\> ### Example diff --git a/docs/jwt/verify/interfaces/JWTVerifyGetKey.md b/docs/jwt/verify/interfaces/JWTVerifyGetKey.md index fb21dd556b..499d751947 100644 --- a/docs/jwt/verify/interfaces/JWTVerifyGetKey.md +++ b/docs/jwt/verify/interfaces/JWTVerifyGetKey.md @@ -11,7 +11,7 @@ the time of this function call. [createRemoteJWKSet](../../../jwks/remote/functions/createRemoteJWKSet.md) to verify using a remote JSON Web Key Set. -▸ **JWTVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> +▸ **JWTVerifyGetKey**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> Interface for JWT Verification dynamic key resolution. No token components have been verified at the time of this function call. @@ -25,7 +25,7 @@ the time of this function call. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](../../../types/interfaces/KeyObject.md) \| [`JWK`](../../../types/interfaces/JWK.md)\> ## See diff --git a/docs/key/export/functions/exportJWK.md b/docs/key/export/functions/exportJWK.md index 481c9eb47e..19d0c4ef68 100644 --- a/docs/key/export/functions/exportJWK.md +++ b/docs/key/export/functions/exportJWK.md @@ -6,7 +6,7 @@ Support from the community to continue maintaining and improving this module is ▸ **exportJWK**(`key`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`JWK`](../../../types/interfaces/JWK.md)\> -Exports a runtime-specific key representation (KeyLike) to a JWK. +Exports a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) to a JWK. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/export'`. @@ -15,7 +15,7 @@ as from its subpath export `'jose/key/export'`. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../../../types/type-aliases/KeyLike.md) | Key representation to export as JWK. | +| `key` | [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) | Key to export as JWK. | ## Returns diff --git a/docs/key/export/functions/exportPKCS8.md b/docs/key/export/functions/exportPKCS8.md index 04689cfadf..93d02b18f8 100644 --- a/docs/key/export/functions/exportPKCS8.md +++ b/docs/key/export/functions/exportPKCS8.md @@ -6,8 +6,7 @@ Support from the community to continue maintaining and improving this module is ▸ **exportPKCS8**(`key`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\> -Exports a runtime-specific private key representation ([KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) or [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey)) to -a PEM-encoded PKCS8 string format. +Exports a private [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) to a PEM-encoded PKCS8 string format. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/export'`. @@ -16,7 +15,7 @@ as from its subpath export `'jose/key/export'`. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | Key representation to transform to a PEM-encoded PKCS8 string format. | +| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) | Key to export to a PEM-encoded PKCS8 string format. | ## Returns diff --git a/docs/key/export/functions/exportSPKI.md b/docs/key/export/functions/exportSPKI.md index e025b7ac8c..808a20c696 100644 --- a/docs/key/export/functions/exportSPKI.md +++ b/docs/key/export/functions/exportSPKI.md @@ -6,8 +6,7 @@ Support from the community to continue maintaining and improving this module is ▸ **exportSPKI**(`key`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`\> -Exports a runtime-specific public key representation ([KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) or [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey)) to -a PEM-encoded SPKI string format. +Exports a public [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) to a PEM-encoded SPKI string format. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/export'`. @@ -16,7 +15,7 @@ as from its subpath export `'jose/key/export'`. | Parameter | Type | Description | | ------ | ------ | ------ | -| `key` | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | Key representation to transform to a PEM-encoded SPKI string format. | +| `key` | [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) | Key to export to a PEM-encoded SPKI string format. | ## Returns diff --git a/docs/key/generate_key_pair/functions/generateKeyPair.md b/docs/key/generate_key_pair/functions/generateKeyPair.md index 37bdf0d591..03790874a5 100644 --- a/docs/key/generate_key_pair/functions/generateKeyPair.md +++ b/docs/key/generate_key_pair/functions/generateKeyPair.md @@ -4,34 +4,27 @@ 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). -▸ **generateKeyPair**\<`KeyLikeType`\>(`alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GenerateKeyPairResult`](../interfaces/GenerateKeyPairResult.md)\<`KeyLikeType`\>\> +▸ **generateKeyPair**(`alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GenerateKeyPairResult`](../interfaces/GenerateKeyPairResult.md)\> Generates a private and a public key for a given JWA algorithm identifier. This can only generate asymmetric key pairs. For symmetric secrets use the `generateSecret` function. -Note: Under Web Crypto API runtime the `privateKey` is generated with `extractable` set to -`false` by default. See [GenerateKeyPairOptions.extractable](../interfaces/GenerateKeyPairOptions.md#extractable) to generate an extractable -`privateKey`. +Note: The `privateKey` is generated with `extractable` set to `false` by default. See +[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'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `alg` | `string` | JWA Algorithm Identifier to be used with the generated key pair. | +| `alg` | `string` | JWA Algorithm Identifier to be used with the generated key pair. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | | `options`? | [`GenerateKeyPairOptions`](../interfaces/GenerateKeyPairOptions.md) | Additional options passed down to the key pair generation. | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GenerateKeyPairResult`](../interfaces/GenerateKeyPairResult.md)\<`KeyLikeType`\>\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`GenerateKeyPairResult`](../interfaces/GenerateKeyPairResult.md)\> ## Example diff --git a/docs/key/generate_key_pair/interfaces/GenerateKeyPairOptions.md b/docs/key/generate_key_pair/interfaces/GenerateKeyPairOptions.md index 15354c9be1..63f3b69814 100644 --- a/docs/key/generate_key_pair/interfaces/GenerateKeyPairOptions.md +++ b/docs/key/generate_key_pair/interfaces/GenerateKeyPairOptions.md @@ -19,8 +19,7 @@ both supported on the runtime as well as applicable for the given JWA algorithm • `optional` **extractable**: `boolean` -(Only effective in Web Crypto API runtimes) The value to use as -[SubtleCrypto.generateKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) `extractable` argument. Default is false. +The value to use as [SubtleCrypto.generateKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) `extractable` argument. Default is false. #### Example diff --git a/docs/key/generate_key_pair/interfaces/GenerateKeyPairResult.md b/docs/key/generate_key_pair/interfaces/GenerateKeyPairResult.md index cb3b736a84..142351189c 100644 --- a/docs/key/generate_key_pair/interfaces/GenerateKeyPairResult.md +++ b/docs/key/generate_key_pair/interfaces/GenerateKeyPairResult.md @@ -1,20 +1,14 @@ -# Interface: GenerateKeyPairResult\ +# Interface: GenerateKeyPairResult ## [💗 Help the project](https://github.com/sponsors/panva) 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). -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Properties ### privateKey -• **privateKey**: `KeyLikeType` +• **privateKey**: [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) The generated Private Key. @@ -22,6 +16,6 @@ The generated Private Key. ### publicKey -• **publicKey**: `KeyLikeType` +• **publicKey**: [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) Public Key corresponding to the generated Private Key. diff --git a/docs/key/generate_secret/functions/generateSecret.md b/docs/key/generate_secret/functions/generateSecret.md index 09ac992162..401d27dedf 100644 --- a/docs/key/generate_secret/functions/generateSecret.md +++ b/docs/key/generate_secret/functions/generateSecret.md @@ -4,32 +4,25 @@ 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). -▸ **generateSecret**\<`KeyLikeType`\>(`alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> +▸ **generateSecret**(`alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> Generates a symmetric secret key for a given JWA algorithm identifier. -Note: Under Web Crypto API runtime the secret key is generated with `extractable` set to `false` -by default. +Note: The secret key is generated with `extractable` set to `false` by default. 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'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `alg` | `string` | JWA Algorithm Identifier to be used with the generated secret. | +| `alg` | `string` | JWA Algorithm Identifier to be used with the generated secret. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | | `options`? | [`GenerateSecretOptions`](../interfaces/GenerateSecretOptions.md) | Additional options passed down to the secret generation. | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> ## Example diff --git a/docs/key/generate_secret/interfaces/GenerateSecretOptions.md b/docs/key/generate_secret/interfaces/GenerateSecretOptions.md index 74d9a59dda..958a24f016 100644 --- a/docs/key/generate_secret/interfaces/GenerateSecretOptions.md +++ b/docs/key/generate_secret/interfaces/GenerateSecretOptions.md @@ -10,5 +10,4 @@ Support from the community to continue maintaining and improving this module is • `optional` **extractable**: `boolean` -(Only effective in Web Crypto API runtimes) The value to use as -[SubtleCrypto.generateKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) `extractable` argument. Default is false. +The value to use as [SubtleCrypto.generateKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) `extractable` argument. Default is false. diff --git a/docs/key/import/functions/importJWK.md b/docs/key/import/functions/importJWK.md index 099209a85c..8e787bc70b 100644 --- a/docs/key/import/functions/importJWK.md +++ b/docs/key/import/functions/importJWK.md @@ -4,33 +4,27 @@ 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). -▸ **importJWK**\<`KeyLikeType`\>(`jwk`, `alg`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> +▸ **importJWK**(`jwk`, `alg`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> -Imports a JWK to a runtime-specific key representation (KeyLike). Either the JWK "alg" -(Algorithm) Parameter, or the optional "alg" argument, must be present. +Imports a JWK to a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). Either the JWK "alg" (Algorithm) Parameter, or the optional +"alg" argument, must be present. -Note: When the runtime is using [Web Cryptography API](https://w3c.github.io/webcrypto/) the -jwk parameters "use", "key_ops", and "ext" are also used in the resulting [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). +Note: The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the +[CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) import process. This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/import'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `jwk` | [`JWK`](../../../types/interfaces/JWK.md) | JSON Web Key. | -| `alg`? | `string` | (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used with the imported key. Default is the "alg" property on the JWK, its presence is only enforced in Web Crypto API runtimes. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | +| `alg`? | `string` | JSON Web Algorithm identifier to be used with the imported key. Default is the "alg" property on the JWK. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType` \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md) \| [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\> ## Example diff --git a/docs/key/import/functions/importPKCS8.md b/docs/key/import/functions/importPKCS8.md index bfae774b84..269c1287ae 100644 --- a/docs/key/import/functions/importPKCS8.md +++ b/docs/key/import/functions/importPKCS8.md @@ -4,10 +4,9 @@ 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). -▸ **importPKCS8**\<`KeyLikeType`\>(`pkcs8`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **importPKCS8**(`pkcs8`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> -Imports a PEM-encoded PKCS#8 string as a runtime-specific private key representation -([KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) or [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey)). +Imports a PEM-encoded PKCS#8 string as a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in [Web Cryptography API](https://w3c.github.io/webcrypto/), use the OID rsaEncryption @@ -16,23 +15,17 @@ Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/import'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `pkcs8` | `string` | PEM-encoded PKCS#8 string | -| `alg` | `string` | (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used with the imported key, its presence is only enforced in Web Crypto API runtimes. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | +| `alg` | `string` | JSON Web Algorithm identifier to be used with the imported key. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | | `options`? | [`PEMImportOptions`](../interfaces/PEMImportOptions.md) | - | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> ## Example diff --git a/docs/key/import/functions/importSPKI.md b/docs/key/import/functions/importSPKI.md index aa9692c558..41b87add14 100644 --- a/docs/key/import/functions/importSPKI.md +++ b/docs/key/import/functions/importSPKI.md @@ -4,10 +4,9 @@ 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). -▸ **importSPKI**\<`KeyLikeType`\>(`spki`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **importSPKI**(`spki`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> -Imports a PEM-encoded SPKI string as a runtime-specific public key representation -([KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) or [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey)). +Imports a PEM-encoded SPKI string as a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in [Web Cryptography API](https://w3c.github.io/webcrypto/), use the OID rsaEncryption @@ -16,23 +15,17 @@ Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/import'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `spki` | `string` | PEM-encoded SPKI string | -| `alg` | `string` | (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used with the imported key, its presence is only enforced in Web Crypto API runtimes. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | +| `alg` | `string` | JSON Web Algorithm identifier to be used with the imported key. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | | `options`? | [`PEMImportOptions`](../interfaces/PEMImportOptions.md) | - | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> ## Example diff --git a/docs/key/import/functions/importX509.md b/docs/key/import/functions/importX509.md index d369c2246a..2667e269b4 100644 --- a/docs/key/import/functions/importX509.md +++ b/docs/key/import/functions/importX509.md @@ -4,10 +4,9 @@ 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). -▸ **importX509**\<`KeyLikeType`\>(`x509`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +▸ **importX509**(`x509`, `alg`, `options`?): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> -Imports the SPKI from an X.509 string certificate as a runtime-specific public key representation -([KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) or [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey)). +Imports the SPKI from an X.509 string certificate as a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in [Web Cryptography API](https://w3c.github.io/webcrypto/), use the OID rsaEncryption @@ -16,23 +15,17 @@ Note: The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in This function is exported (as a named export) from the main `'jose'` module entry point as well as from its subpath export `'jose/key/import'`. -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../../../types/type-aliases/KeyLike.md) | [`KeyLike`](../../../types/type-aliases/KeyLike.md) | - ## Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `x509` | `string` | X.509 certificate string | -| `alg` | `string` | (Only effective in Web Crypto API runtimes) JSON Web Algorithm identifier to be used with the imported key, its presence is only enforced in Web Crypto API runtimes. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | +| `alg` | `string` | JSON Web Algorithm identifier to be used with the imported key. See [Algorithm Key Requirements](https://github.com/panva/jose/issues/210). | | `options`? | [`PEMImportOptions`](../interfaces/PEMImportOptions.md) | - | ## Returns -[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`KeyLikeType`\> +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`CryptoKey`](../../../types/type-aliases/CryptoKey.md)\> ## Example diff --git a/docs/key/import/interfaces/PEMImportOptions.md b/docs/key/import/interfaces/PEMImportOptions.md index 4168f0e3e1..c9219b3403 100644 --- a/docs/key/import/interfaces/PEMImportOptions.md +++ b/docs/key/import/interfaces/PEMImportOptions.md @@ -10,5 +10,5 @@ Support from the community to continue maintaining and improving this module is • `optional` **extractable**: `boolean` -(Only effective in Web Crypto API runtimes) The value to use as [SubtleCrypto.importKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) -`extractable` argument. Default is false. +The value to use as [SubtleCrypto.importKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) `extractable` argument. Default is false for +private and secret keys, true otherwise. diff --git a/docs/types/README.md b/docs/types/README.md index b2529f54e5..8eeecf65d9 100644 --- a/docs/types/README.md +++ b/docs/types/README.md @@ -41,11 +41,12 @@ - [JWTHeaderParameters](interfaces/JWTHeaderParameters.md) - [JWTPayload](interfaces/JWTPayload.md) - [JWTVerifyResult](interfaces/JWTVerifyResult.md) +- [KeyObject](interfaces/KeyObject.md) - [ResolvedKey](interfaces/ResolvedKey.md) - [SignOptions](interfaces/SignOptions.md) - [VerifyOptions](interfaces/VerifyOptions.md) ### Type Aliases -- [CryptoRuntime](type-aliases/CryptoRuntime.md) +- [CryptoKey](type-aliases/CryptoKey.md) - [KeyLike](type-aliases/KeyLike.md) diff --git a/docs/types/interfaces/GetKeyFunction.md b/docs/types/interfaces/GetKeyFunction.md index 901cc293d7..805bbae75f 100644 --- a/docs/types/interfaces/GetKeyFunction.md +++ b/docs/types/interfaces/GetKeyFunction.md @@ -13,7 +13,7 @@ Generic Interface for consuming operations dynamic key resolution. | `IProtectedHeader` | Type definition of the JWE or JWS Protected Header. | | `IToken` | Type definition of the consumed JWE or JWS token. | -▸ **GetKeyFunction**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../type-aliases/KeyLike.md)\> +▸ **GetKeyFunction**(`protectedHeader`, `token`): [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](KeyObject.md) \| [`JWK`](JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](KeyObject.md) \| [`JWK`](JWK.md)\> Generic Interface for consuming operations dynamic key resolution. @@ -26,4 +26,4 @@ Generic Interface for consuming operations dynamic key resolution. ## Returns -[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../type-aliases/KeyLike.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`KeyLike`](../type-aliases/KeyLike.md)\> +[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](KeyObject.md) \| [`JWK`](JWK.md) \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](KeyObject.md) \| [`JWK`](JWK.md)\> diff --git a/docs/types/interfaces/JWEKeyManagementHeaderParameters.md b/docs/types/interfaces/JWEKeyManagementHeaderParameters.md index 984bac6192..fd59eb095b 100644 --- a/docs/types/interfaces/JWEKeyManagementHeaderParameters.md +++ b/docs/types/interfaces/JWEKeyManagementHeaderParameters.md @@ -22,7 +22,7 @@ Recognized JWE Key Management-related Header Parameters. ### ~~epk?~~ -• `optional` **epk**: [`KeyLike`](../type-aliases/KeyLike.md) +• `optional` **epk**: [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) \| [`KeyObject`](KeyObject.md) #### Deprecated diff --git a/docs/types/interfaces/KeyObject.md b/docs/types/interfaces/KeyObject.md new file mode 100644 index 0000000000..8bc52481d5 --- /dev/null +++ b/docs/types/interfaces/KeyObject.md @@ -0,0 +1,15 @@ +# Interface: KeyObject + +## [💗 Help the project](https://github.com/sponsors/panva) + +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). + +[KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) is a representation of a key/secret available in the Node.js runtime. You may +use the Node.js runtime APIs [createPublicKey](https://nodejs.org/api/crypto.html#cryptocreatepublickeykey), [createPrivateKey](https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey), and +[createSecretKey](https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding) to obtain a [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) from your existing key material. + +## Properties + +### type + +• **type**: `string` diff --git a/docs/types/interfaces/ResolvedKey.md b/docs/types/interfaces/ResolvedKey.md index 06c3d47462..81802e374d 100644 --- a/docs/types/interfaces/ResolvedKey.md +++ b/docs/types/interfaces/ResolvedKey.md @@ -1,19 +1,13 @@ -# Interface: ResolvedKey\ +# Interface: ResolvedKey ## [💗 Help the project](https://github.com/sponsors/panva) 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). -## Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `KeyLikeType` *extends* [`KeyLike`](../type-aliases/KeyLike.md) | [`KeyLike`](../type-aliases/KeyLike.md) | - ## Properties ### key -• **key**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| `KeyLikeType` +• **key**: [`Uint8Array`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) \| [`CryptoKey`](https://developer.mozilla.org/docs/Web/API/CryptoKey) Key resolved from the key resolver function. diff --git a/docs/types/type-aliases/CryptoKey.md b/docs/types/type-aliases/CryptoKey.md new file mode 100644 index 0000000000..9c14d1ed42 --- /dev/null +++ b/docs/types/type-aliases/CryptoKey.md @@ -0,0 +1,12 @@ +# Type Alias: CryptoKey + +## [💗 Help the project](https://github.com/sponsors/panva) + +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). + +• **CryptoKey**: [`Extract`](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union)\<[`Awaited`](https://www.typescriptlang.org/docs/handbook/utility-types.html#awaitedtype)\<[`ReturnType`](https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypetype)\<*typeof* [`crypto.subtle.generateKey`](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\>\>, `object`\> + +[CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) is a representation of a key/secret available in all supported runtimes. In +addition to the [Key Import Functions](../../key/import/README.md) you may use the +[SubtleCrypto.importKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) API to obtain a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) from your existing key +material. diff --git a/docs/types/type-aliases/CryptoRuntime.md b/docs/types/type-aliases/CryptoRuntime.md deleted file mode 100644 index ef92635de0..0000000000 --- a/docs/types/type-aliases/CryptoRuntime.md +++ /dev/null @@ -1,7 +0,0 @@ -# Type Alias: CryptoRuntime - -## [💗 Help the project](https://github.com/sponsors/panva) - -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). - -• **CryptoRuntime**: `"WebCryptoAPI"` \| `"node:crypto"` diff --git a/docs/types/type-aliases/KeyLike.md b/docs/types/type-aliases/KeyLike.md index 63918949ff..92416011c5 100644 --- a/docs/types/type-aliases/KeyLike.md +++ b/docs/types/type-aliases/KeyLike.md @@ -4,34 +4,18 @@ 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). -• **KeyLike**: `object` +• **KeyLike**: [`CryptoKey`](CryptoKey.md) \| [`KeyObject`](../interfaces/KeyObject.md) KeyLike are runtime-specific classes representing asymmetric keys or symmetric secrets. These are -instances of [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) and additionally [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) in Node.js runtime. +instances of [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) and additionally [KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) in the Node.js runtime. [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instances are also accepted as symmetric secret representation only. [Key Import Functions](../../key/import/README.md) can be used to import PEM, or JWK formatted asymmetric -keys and certificates to these runtime-specific representations. +keys and certificates as [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey). In Node.js the [Buffer](https://nodejs.org/api/buffer.html#class-buffer) class is a subclass of [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) and so [Buffer](https://nodejs.org/api/buffer.html#class-buffer) can be provided for symmetric secrets as well. -[KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) is a representation of a key/secret available in the Node.js runtime. In -addition to the [Key Import Functions](../../key/import/README.md) you may use the runtime APIs -[createPublicKey](https://nodejs.org/api/crypto.html#cryptocreatepublickeykey), [createPrivateKey](https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey), and [createSecretKey](https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding) to obtain a -[KeyObject](https://nodejs.org/api/crypto.html#class-keyobject) from your existing key material. - -[CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) is a representation of a key/secret available in the Browser and -Web-interoperable runtimes. In addition to the [Key Import Functions](../../key/import/README.md) you may use -the [SubtleCrypto.importKey](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) API to obtain a [CryptoKey](https://developer.mozilla.org/docs/Web/API/CryptoKey) from your existing key -material. - -## Type declaration - -### type - -• **type**: `string` - ## Examples Import a PEM-encoded SPKI Public Key