From 72ecff6574d252f407b6e145a166c995cdd85949 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Mon, 26 Aug 2024 12:02:07 +0200 Subject: [PATCH] feat: add subpath module exports --- .../jwe_compact_encrypt.CompactEncrypt.md | 3 + .../jwe_flattened_encrypt.FlattenedEncrypt.md | 3 + .../jwe_general_encrypt.GeneralEncrypt.md | 3 + docs/classes/jws_compact_sign.CompactSign.md | 3 + .../jws_flattened_sign.FlattenedSign.md | 3 + docs/classes/jws_general_sign.GeneralSign.md | 3 + docs/classes/jwt_encrypt.EncryptJWT.md | 3 + docs/classes/jwt_sign.SignJWT.md | 3 + docs/classes/jwt_unsecured.UnsecuredJWT.md | 3 + .../jwe_compact_decrypt.compactDecrypt.md | 3 + .../jwe_flattened_decrypt.flattenedDecrypt.md | 3 + .../jwe_general_decrypt.generalDecrypt.md | 3 + docs/functions/jwk_embedded.EmbeddedJWK.md | 3 + .../jwk_thumbprint.calculateJwkThumbprint.md | 3 + ...wk_thumbprint.calculateJwkThumbprintUri.md | 3 + .../functions/jwks_local.createLocalJWKSet.md | 3 + .../jwks_remote.createRemoteJWKSet.md | 3 + .../jws_compact_verify.compactVerify.md | 3 + .../jws_flattened_verify.flattenedVerify.md | 3 + .../jws_general_verify.generalVerify.md | 3 + docs/functions/jwt_decrypt.jwtDecrypt.md | 3 + docs/functions/jwt_verify.jwtVerify.md | 3 + docs/functions/key_export.exportJWK.md | 3 + docs/functions/key_export.exportPKCS8.md | 3 + docs/functions/key_export.exportSPKI.md | 3 + .../key_generate_key_pair.generateKeyPair.md | 3 + .../key_generate_secret.generateSecret.md | 3 + docs/functions/key_import.importJWK.md | 3 + docs/functions/key_import.importPKCS8.md | 3 + docs/functions/key_import.importSPKI.md | 3 + docs/functions/key_import.importX509.md | 3 + docs/functions/util_decode_jwt.decodeJwt.md | 3 + ..._protected_header.decodeProtectedHeader.md | 3 + package.json | 270 ++++++++++++++++++ src/jwe/compact/decrypt.ts | 3 + src/jwe/compact/encrypt.ts | 3 + src/jwe/flattened/decrypt.ts | 3 + src/jwe/flattened/encrypt.ts | 7 +- src/jwe/general/decrypt.ts | 3 + src/jwe/general/encrypt.ts | 6 +- src/jwk/embedded.ts | 3 + src/jwk/thumbprint.ts | 6 + src/jwks/local.ts | 3 + src/jwks/remote.ts | 3 + src/jws/compact/sign.ts | 3 + src/jws/compact/verify.ts | 3 + src/jws/flattened/sign.ts | 3 + src/jws/flattened/verify.ts | 3 + src/jws/general/sign.ts | 3 + src/jws/general/verify.ts | 3 + src/jwt/decrypt.ts | 3 + src/jwt/encrypt.ts | 3 + src/jwt/sign.ts | 3 + src/jwt/unsecured.ts | 3 + src/jwt/verify.ts | 3 + src/key/export.ts | 9 + src/key/generate_key_pair.ts | 3 + src/key/generate_secret.ts | 3 + src/key/import.ts | 12 + src/lib/private_symbols.ts | 1 + src/util/decode_jwt.ts | 3 + src/util/decode_protected_header.ts | 3 + 62 files changed, 472 insertions(+), 4 deletions(-) create mode 100644 src/lib/private_symbols.ts diff --git a/docs/classes/jwe_compact_encrypt.CompactEncrypt.md b/docs/classes/jwe_compact_encrypt.CompactEncrypt.md index ef76298548..cc92d280cc 100644 --- a/docs/classes/jwe_compact_encrypt.CompactEncrypt.md +++ b/docs/classes/jwe_compact_encrypt.CompactEncrypt.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The CompactEncrypt class is used to build and encrypt Compact JWE strings. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwe/compact/encrypt'`. + **`Example`** ```js diff --git a/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md b/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md index 3d2197b7d2..7413e300cd 100644 --- a/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md +++ b/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwe/flattened/encrypt'`. + **`Example`** ```js diff --git a/docs/classes/jwe_general_encrypt.GeneralEncrypt.md b/docs/classes/jwe_general_encrypt.GeneralEncrypt.md index 04797f8c25..ff5112ba65 100644 --- a/docs/classes/jwe_general_encrypt.GeneralEncrypt.md +++ b/docs/classes/jwe_general_encrypt.GeneralEncrypt.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The GeneralEncrypt class is used to build and encrypt General JWE objects. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwe/general/encrypt'`. + **`Example`** ```js diff --git a/docs/classes/jws_compact_sign.CompactSign.md b/docs/classes/jws_compact_sign.CompactSign.md index d9ed61dcb9..0567a92eb3 100644 --- a/docs/classes/jws_compact_sign.CompactSign.md +++ b/docs/classes/jws_compact_sign.CompactSign.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The CompactSign class is used to build and sign Compact JWS strings. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jws/compact/sign'`. + **`Example`** ```js diff --git a/docs/classes/jws_flattened_sign.FlattenedSign.md b/docs/classes/jws_flattened_sign.FlattenedSign.md index f175331ab8..113e6be146 100644 --- a/docs/classes/jws_flattened_sign.FlattenedSign.md +++ b/docs/classes/jws_flattened_sign.FlattenedSign.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The FlattenedSign class is used to build and sign Flattened JWS objects. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jws/flattened/sign'`. + **`Example`** ```js diff --git a/docs/classes/jws_general_sign.GeneralSign.md b/docs/classes/jws_general_sign.GeneralSign.md index 437fe6134e..d58b625050 100644 --- a/docs/classes/jws_general_sign.GeneralSign.md +++ b/docs/classes/jws_general_sign.GeneralSign.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The GeneralSign class is used to build and sign General JWS objects. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jws/general/sign'`. + **`Example`** ```js diff --git a/docs/classes/jwt_encrypt.EncryptJWT.md b/docs/classes/jwt_encrypt.EncryptJWT.md index 8b2f8f8509..4d43fb6cf4 100644 --- a/docs/classes/jwt_encrypt.EncryptJWT.md +++ b/docs/classes/jwt_encrypt.EncryptJWT.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwt/encrypt'`. + **`Example`** ```js diff --git a/docs/classes/jwt_sign.SignJWT.md b/docs/classes/jwt_sign.SignJWT.md index 9906785e69..f72d688eb5 100644 --- a/docs/classes/jwt_sign.SignJWT.md +++ b/docs/classes/jwt_sign.SignJWT.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwt/sign'`. + **`Example`** Usage with a symmetric secret diff --git a/docs/classes/jwt_unsecured.UnsecuredJWT.md b/docs/classes/jwt_unsecured.UnsecuredJWT.md index a5712458df..4229c88ba5 100644 --- a/docs/classes/jwt_unsecured.UnsecuredJWT.md +++ b/docs/classes/jwt_unsecured.UnsecuredJWT.md @@ -8,6 +8,9 @@ Support from the community to continue maintaining and improving this module is The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs. +This class is exported (as a named export) from the main `'jose'` module entry point as well as +from its subpath export `'jose/jwt/unsecured'`. + **`Example`** Encoding diff --git a/docs/functions/jwe_compact_decrypt.compactDecrypt.md b/docs/functions/jwe_compact_decrypt.compactDecrypt.md index 591a5d50a9..12fa579272 100644 --- a/docs/functions/jwe_compact_decrypt.compactDecrypt.md +++ b/docs/functions/jwe_compact_decrypt.compactDecrypt.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Decrypts a Compact JWE. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwe/compact/decrypt'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md b/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md index 10006f97c8..c679c66bf5 100644 --- a/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md +++ b/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Decrypts a Flattened JWE. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwe/flattened/decrypt'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwe_general_decrypt.generalDecrypt.md b/docs/functions/jwe_general_decrypt.generalDecrypt.md index 2395a96ebc..914f43491b 100644 --- a/docs/functions/jwe_general_decrypt.generalDecrypt.md +++ b/docs/functions/jwe_general_decrypt.generalDecrypt.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Decrypts a General JWE. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwe/general/decrypt'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwk_embedded.EmbeddedJWK.md b/docs/functions/jwk_embedded.EmbeddedJWK.md index fb13c8d8e9..f7154b540a 100644 --- a/docs/functions/jwk_embedded.EmbeddedJWK.md +++ b/docs/functions/jwk_embedded.EmbeddedJWK.md @@ -13,6 +13,9 @@ operations whenever you need to opt-in to verify signatures with a public key em token's "jwk" (JSON Web Key) Header Parameter. It is recommended to combine this with the verify function's `algorithms` option to define accepted JWS "alg" (Algorithm) Header Parameter values. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwk/embedded'`. + #### Type parameters | Name | Type | diff --git a/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md b/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md index f8a94eabe7..3a84726cc7 100644 --- a/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md +++ b/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwk/thumbprint'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwk_thumbprint.calculateJwkThumbprintUri.md b/docs/functions/jwk_thumbprint.calculateJwkThumbprintUri.md index 4fa9fa5a2f..4be0a581cd 100644 --- a/docs/functions/jwk_thumbprint.calculateJwkThumbprintUri.md +++ b/docs/functions/jwk_thumbprint.calculateJwkThumbprintUri.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Calculates a JSON Web Key (JWK) Thumbprint URI +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwk/thumbprint'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwks_local.createLocalJWKSet.md b/docs/functions/jwks_local.createLocalJWKSet.md index 69bd65c3b3..76270a504c 100644 --- a/docs/functions/jwks_local.createLocalJWKSet.md +++ b/docs/functions/jwks_local.createLocalJWKSet.md @@ -23,6 +23,9 @@ verification in an iterative manner. Note: The function's purpose is to resolve public keys used for verifying signatures and will not 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 | Name | Type | diff --git a/docs/functions/jwks_remote.createRemoteJWKSet.md b/docs/functions/jwks_remote.createRemoteJWKSet.md index 537e8892ed..0833b9c0c1 100644 --- a/docs/functions/jwks_remote.createRemoteJWKSet.md +++ b/docs/functions/jwks_remote.createRemoteJWKSet.md @@ -25,6 +25,9 @@ verification in an iterative manner. Note: The function's purpose is to resolve public keys used for verifying signatures and will not 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 | Name | Type | diff --git a/docs/functions/jws_compact_verify.compactVerify.md b/docs/functions/jws_compact_verify.compactVerify.md index 064b65ba2c..8e99b4d731 100644 --- a/docs/functions/jws_compact_verify.compactVerify.md +++ b/docs/functions/jws_compact_verify.compactVerify.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Verifies the signature and format of and afterwards decodes the Compact JWS. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jws/compact/verify'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jws_flattened_verify.flattenedVerify.md b/docs/functions/jws_flattened_verify.flattenedVerify.md index 7cd0b98bcd..7028b32bd8 100644 --- a/docs/functions/jws_flattened_verify.flattenedVerify.md +++ b/docs/functions/jws_flattened_verify.flattenedVerify.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Verifies the signature and format of and afterwards decodes the Flattened JWS. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jws/flattened/verify'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jws_general_verify.generalVerify.md b/docs/functions/jws_general_verify.generalVerify.md index b63cdc335b..453985a04e 100644 --- a/docs/functions/jws_general_verify.generalVerify.md +++ b/docs/functions/jws_general_verify.generalVerify.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Verifies the signature and format of and afterwards decodes the General JWS. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jws/general/verify'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwt_decrypt.jwtDecrypt.md b/docs/functions/jwt_decrypt.jwtDecrypt.md index f4f7e1d24f..7eb1c81e7d 100644 --- a/docs/functions/jwt_decrypt.jwtDecrypt.md +++ b/docs/functions/jwt_decrypt.jwtDecrypt.md @@ -11,6 +11,9 @@ Support from the community to continue maintaining and improving this module is Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT Claims Set. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwt/decrypt'`. + #### Type parameters | Name | Type | diff --git a/docs/functions/jwt_verify.jwtVerify.md b/docs/functions/jwt_verify.jwtVerify.md index 21318ad270..a5fb1ef452 100644 --- a/docs/functions/jwt_verify.jwtVerify.md +++ b/docs/functions/jwt_verify.jwtVerify.md @@ -11,6 +11,9 @@ Support from the community to continue maintaining and improving this module is Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the JWT Claims Set. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwt/verify'`. + #### Type parameters | Name | Type | diff --git a/docs/functions/key_export.exportJWK.md b/docs/functions/key_export.exportJWK.md index ecfa228156..dc47e05a6c 100644 --- a/docs/functions/key_export.exportJWK.md +++ b/docs/functions/key_export.exportJWK.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Exports a runtime-specific key representation (KeyLike) 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'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_export.exportPKCS8.md b/docs/functions/key_export.exportPKCS8.md index 3846a4e8d7..b2f499a149 100644 --- a/docs/functions/key_export.exportPKCS8.md +++ b/docs/functions/key_export.exportPKCS8.md @@ -11,6 +11,9 @@ Support from the community to continue maintaining and improving this module is Exports a runtime-specific private key representation (KeyObject or 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'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_export.exportSPKI.md b/docs/functions/key_export.exportSPKI.md index ef791a3474..d8ca2ed4b3 100644 --- a/docs/functions/key_export.exportSPKI.md +++ b/docs/functions/key_export.exportSPKI.md @@ -11,6 +11,9 @@ Support from the community to continue maintaining and improving this module is Exports a runtime-specific public key representation (KeyObject or 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'`. + #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_generate_key_pair.generateKeyPair.md b/docs/functions/key_generate_key_pair.generateKeyPair.md index c187df90e9..5344e421c1 100644 --- a/docs/functions/key_generate_key_pair.generateKeyPair.md +++ b/docs/functions/key_generate_key_pair.generateKeyPair.md @@ -15,6 +15,9 @@ Note: Under Web Crypto API runtime the `privateKey` is generated with `extractab `false` by default. See [GenerateKeyPairOptions.extractable](../interfaces/key_generate_key_pair.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 | Name | Type | diff --git a/docs/functions/key_generate_secret.generateSecret.md b/docs/functions/key_generate_secret.generateSecret.md index 651467b67b..54675cd090 100644 --- a/docs/functions/key_generate_secret.generateSecret.md +++ b/docs/functions/key_generate_secret.generateSecret.md @@ -13,6 +13,9 @@ 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. +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 | Name | Type | diff --git a/docs/functions/key_import.importJWK.md b/docs/functions/key_import.importJWK.md index a26ef6ec8d..42109d1fc4 100644 --- a/docs/functions/key_import.importJWK.md +++ b/docs/functions/key_import.importJWK.md @@ -14,6 +14,9 @@ Imports a JWK to a runtime-specific key representation (KeyLike). Either the JWK 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`. +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 | Name | Type | diff --git a/docs/functions/key_import.importPKCS8.md b/docs/functions/key_import.importPKCS8.md index 2cf9a162ee..bf9ba214bc 100644 --- a/docs/functions/key_import.importPKCS8.md +++ b/docs/functions/key_import.importPKCS8.md @@ -15,6 +15,9 @@ 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 (1.2.840.113549.1.1.1) instead for all RSA algorithms. +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 | Name | Type | diff --git a/docs/functions/key_import.importSPKI.md b/docs/functions/key_import.importSPKI.md index fee7317887..9a8f116245 100644 --- a/docs/functions/key_import.importSPKI.md +++ b/docs/functions/key_import.importSPKI.md @@ -15,6 +15,9 @@ 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 (1.2.840.113549.1.1.1) instead for all RSA algorithms. +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 | Name | Type | diff --git a/docs/functions/key_import.importX509.md b/docs/functions/key_import.importX509.md index e3d2b7e141..85744d76b5 100644 --- a/docs/functions/key_import.importX509.md +++ b/docs/functions/key_import.importX509.md @@ -15,6 +15,9 @@ 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 (1.2.840.113549.1.1.1) instead for all RSA algorithms. +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 | Name | Type | diff --git a/docs/functions/util_decode_jwt.decodeJwt.md b/docs/functions/util_decode_jwt.decodeJwt.md index 2b0686acf8..274f7fd417 100644 --- a/docs/functions/util_decode_jwt.decodeJwt.md +++ b/docs/functions/util_decode_jwt.decodeJwt.md @@ -13,6 +13,9 @@ values. This does not validate the JWS Signature. For a proper Signed JWT Claims and JWS signature verification use `jose.jwtVerify()`. For an encrypted JWT Claims Set validation and JWE decryption use `jose.jwtDecrypt()`. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/jwt/decode'`. + #### Type parameters | Name | Type | diff --git a/docs/functions/util_decode_protected_header.decodeProtectedHeader.md b/docs/functions/util_decode_protected_header.decodeProtectedHeader.md index f7a903858f..814495eecb 100644 --- a/docs/functions/util_decode_protected_header.decodeProtectedHeader.md +++ b/docs/functions/util_decode_protected_header.decodeProtectedHeader.md @@ -10,6 +10,9 @@ Support from the community to continue maintaining and improving this module is Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization. +This function is exported (as a named export) from the main `'jose'` module entry point as well +as from its subpath export `'jose/decode/protected_header'`. + #### Parameters | Name | Type | Description | diff --git a/package.json b/package.json index 8a0c100aa6..c7a6e7e9b2 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,276 @@ "import": "./dist/node/esm/index.js", "require": "./dist/node/cjs/index.js" }, + "./jwk/embedded": { + "types": "./dist/types/jwk/embedded.d.ts", + "bun": "./dist/browser/jwk/embedded.js", + "deno": "./dist/browser/jwk/embedded.js", + "browser": "./dist/browser/jwk/embedded.js", + "worker": "./dist/browser/jwk/embedded.js", + "workerd": "./dist/browser/jwk/embedded.js", + "import": "./dist/node/esm/jwk/embedded.js", + "require": "./dist/node/cjs/jwk/embedded.js" + }, + "./jwk/thumbprint": { + "types": "./dist/types/jwk/thumbprint.d.ts", + "bun": "./dist/browser/jwk/thumbprint.js", + "deno": "./dist/browser/jwk/thumbprint.js", + "browser": "./dist/browser/jwk/thumbprint.js", + "worker": "./dist/browser/jwk/thumbprint.js", + "workerd": "./dist/browser/jwk/thumbprint.js", + "import": "./dist/node/esm/jwk/thumbprint.js", + "require": "./dist/node/cjs/jwk/thumbprint.js" + }, + "./key/import": { + "types": "./dist/types/key/import.d.ts", + "bun": "./dist/browser/key/import.js", + "deno": "./dist/browser/key/import.js", + "browser": "./dist/browser/key/import.js", + "worker": "./dist/browser/key/import.js", + "workerd": "./dist/browser/key/import.js", + "import": "./dist/node/esm/key/import.js", + "require": "./dist/node/cjs/key/import.js" + }, + "./key/export": { + "types": "./dist/types/key/export.d.ts", + "bun": "./dist/browser/key/export.js", + "deno": "./dist/browser/key/export.js", + "browser": "./dist/browser/key/export.js", + "worker": "./dist/browser/key/export.js", + "workerd": "./dist/browser/key/export.js", + "import": "./dist/node/esm/key/export.js", + "require": "./dist/node/cjs/key/export.js" + }, + "./key/generate/keypair": { + "types": "./dist/types/key/generate_key_pair.d.ts", + "bun": "./dist/browser/key/generate_key_pair.js", + "deno": "./dist/browser/key/generate_key_pair.js", + "browser": "./dist/browser/key/generate_key_pair.js", + "worker": "./dist/browser/key/generate_key_pair.js", + "workerd": "./dist/browser/key/generate_key_pair.js", + "import": "./dist/node/esm/key/generate_key_pair.js", + "require": "./dist/node/cjs/key/generate_key_pair.js" + }, + "./key/generate/secret": { + "types": "./dist/types/key/generate_secret.d.ts", + "bun": "./dist/browser/key/generate_secret.js", + "deno": "./dist/browser/key/generate_secret.js", + "browser": "./dist/browser/key/generate_secret.js", + "worker": "./dist/browser/key/generate_secret.js", + "workerd": "./dist/browser/key/generate_secret.js", + "import": "./dist/node/esm/key/generate_secret.js", + "require": "./dist/node/cjs/key/generate_secret.js" + }, + "./jwks/remote": { + "types": "./dist/types/jwks/remote.d.ts", + "bun": "./dist/browser/jwks/remote.js", + "deno": "./dist/browser/jwks/remote.js", + "browser": "./dist/browser/jwks/remote.js", + "worker": "./dist/browser/jwks/remote.js", + "workerd": "./dist/browser/jwks/remote.js", + "import": "./dist/node/esm/jwks/remote.js", + "require": "./dist/node/cjs/jwks/remote.js" + }, + "./jwks/local": { + "types": "./dist/types/jwks/local.d.ts", + "bun": "./dist/browser/jwks/local.js", + "deno": "./dist/browser/jwks/local.js", + "browser": "./dist/browser/jwks/local.js", + "worker": "./dist/browser/jwks/local.js", + "workerd": "./dist/browser/jwks/local.js", + "import": "./dist/node/esm/jwks/local.js", + "require": "./dist/node/cjs/jwks/local.js" + }, + "./jwt/sign": { + "types": "./dist/types/jwt/sign.d.ts", + "bun": "./dist/browser/jwt/sign.js", + "deno": "./dist/browser/jwt/sign.js", + "browser": "./dist/browser/jwt/sign.js", + "worker": "./dist/browser/jwt/sign.js", + "workerd": "./dist/browser/jwt/sign.js", + "import": "./dist/node/esm/jwt/sign.js", + "require": "./dist/node/cjs/jwt/sign.js" + }, + "./jwt/verify": { + "types": "./dist/types/jwt/verify.d.ts", + "bun": "./dist/browser/jwt/verify.js", + "deno": "./dist/browser/jwt/verify.js", + "browser": "./dist/browser/jwt/verify.js", + "worker": "./dist/browser/jwt/verify.js", + "workerd": "./dist/browser/jwt/verify.js", + "import": "./dist/node/esm/jwt/verify.js", + "require": "./dist/node/cjs/jwt/verify.js" + }, + "./jwt/encrypt": { + "types": "./dist/types/jwt/encrypt.d.ts", + "bun": "./dist/browser/jwt/encrypt.js", + "deno": "./dist/browser/jwt/encrypt.js", + "browser": "./dist/browser/jwt/encrypt.js", + "worker": "./dist/browser/jwt/encrypt.js", + "workerd": "./dist/browser/jwt/encrypt.js", + "import": "./dist/node/esm/jwt/encrypt.js", + "require": "./dist/node/cjs/jwt/encrypt.js" + }, + "./jwt/decrypt": { + "types": "./dist/types/jwt/decrypt.d.ts", + "bun": "./dist/browser/jwt/decrypt.js", + "deno": "./dist/browser/jwt/decrypt.js", + "browser": "./dist/browser/jwt/decrypt.js", + "worker": "./dist/browser/jwt/decrypt.js", + "workerd": "./dist/browser/jwt/decrypt.js", + "import": "./dist/node/esm/jwt/decrypt.js", + "require": "./dist/node/cjs/jwt/decrypt.js" + }, + "./jwt/unsecured": { + "types": "./dist/types/jwt/unsecured.d.ts", + "bun": "./dist/browser/jwt/unsecured.js", + "deno": "./dist/browser/jwt/unsecured.js", + "browser": "./dist/browser/jwt/unsecured.js", + "worker": "./dist/browser/jwt/unsecured.js", + "workerd": "./dist/browser/jwt/unsecured.js", + "import": "./dist/node/esm/jwt/unsecured.js", + "require": "./dist/node/cjs/jwt/unsecured.js" + }, + "./jwt/decode": { + "types": "./dist/types/util/decode_jwt.d.ts", + "bun": "./dist/browser/util/decode_jwt.js", + "deno": "./dist/browser/util/decode_jwt.js", + "browser": "./dist/browser/util/decode_jwt.js", + "worker": "./dist/browser/util/decode_jwt.js", + "workerd": "./dist/browser/util/decode_jwt.js", + "import": "./dist/node/esm/util/decode_jwt.js", + "require": "./dist/node/cjs/util/decode_jwt.js" + }, + "./decode/protected_header": { + "types": "./dist/types/util/decode_protected_header.d.ts", + "bun": "./dist/browser/util/decode_protected_header.js", + "deno": "./dist/browser/util/decode_protected_header.js", + "browser": "./dist/browser/util/decode_protected_header.js", + "worker": "./dist/browser/util/decode_protected_header.js", + "workerd": "./dist/browser/util/decode_protected_header.js", + "import": "./dist/node/esm/util/decode_protected_header.js", + "require": "./dist/node/cjs/util/decode_protected_header.js" + }, + "./jws/compact/sign": { + "types": "./dist/types/jws/compact/sign.d.ts", + "bun": "./dist/browser/jws/compact/sign.js", + "deno": "./dist/browser/jws/compact/sign.js", + "browser": "./dist/browser/jws/compact/sign.js", + "worker": "./dist/browser/jws/compact/sign.js", + "workerd": "./dist/browser/jws/compact/sign.js", + "import": "./dist/node/esm/jws/compact/sign.js", + "require": "./dist/node/cjs/jws/compact/sign.js" + }, + "./jws/compact/verify": { + "types": "./dist/types/jws/compact/verify.d.ts", + "bun": "./dist/browser/jws/compact/verify.js", + "deno": "./dist/browser/jws/compact/verify.js", + "browser": "./dist/browser/jws/compact/verify.js", + "worker": "./dist/browser/jws/compact/verify.js", + "workerd": "./dist/browser/jws/compact/verify.js", + "import": "./dist/node/esm/jws/compact/verify.js", + "require": "./dist/node/cjs/jws/compact/verify.js" + }, + "./jws/flattened/sign": { + "types": "./dist/types/jws/flattened/sign.d.ts", + "bun": "./dist/browser/jws/flattened/sign.js", + "deno": "./dist/browser/jws/flattened/sign.js", + "browser": "./dist/browser/jws/flattened/sign.js", + "worker": "./dist/browser/jws/flattened/sign.js", + "workerd": "./dist/browser/jws/flattened/sign.js", + "import": "./dist/node/esm/jws/flattened/sign.js", + "require": "./dist/node/cjs/jws/flattened/sign.js" + }, + "./jws/flattened/verify": { + "types": "./dist/types/jws/flattened/verify.d.ts", + "bun": "./dist/browser/jws/flattened/verify.js", + "deno": "./dist/browser/jws/flattened/verify.js", + "browser": "./dist/browser/jws/flattened/verify.js", + "worker": "./dist/browser/jws/flattened/verify.js", + "workerd": "./dist/browser/jws/flattened/verify.js", + "import": "./dist/node/esm/jws/flattened/verify.js", + "require": "./dist/node/cjs/jws/flattened/verify.js" + }, + "./jws/general/sign": { + "types": "./dist/types/jws/general/sign.d.ts", + "bun": "./dist/browser/jws/general/sign.js", + "deno": "./dist/browser/jws/general/sign.js", + "browser": "./dist/browser/jws/general/sign.js", + "worker": "./dist/browser/jws/general/sign.js", + "workerd": "./dist/browser/jws/general/sign.js", + "import": "./dist/node/esm/jws/general/sign.js", + "require": "./dist/node/cjs/jws/general/sign.js" + }, + "./jws/general/verify": { + "types": "./dist/types/jws/general/verify.d.ts", + "bun": "./dist/browser/jws/general/verify.js", + "deno": "./dist/browser/jws/general/verify.js", + "browser": "./dist/browser/jws/general/verify.js", + "worker": "./dist/browser/jws/general/verify.js", + "workerd": "./dist/browser/jws/general/verify.js", + "import": "./dist/node/esm/jws/general/verify.js", + "require": "./dist/node/cjs/jws/general/verify.js" + }, + "./jwe/compact/encrypt": { + "types": "./dist/types/jwe/compact/encrypt.d.ts", + "bun": "./dist/browser/jwe/compact/encrypt.js", + "deno": "./dist/browser/jwe/compact/encrypt.js", + "browser": "./dist/browser/jwe/compact/encrypt.js", + "worker": "./dist/browser/jwe/compact/encrypt.js", + "workerd": "./dist/browser/jwe/compact/encrypt.js", + "import": "./dist/node/esm/jwe/compact/encrypt.js", + "require": "./dist/node/cjs/jwe/compact/encrypt.js" + }, + "./jwe/compact/decrypt": { + "types": "./dist/types/jwe/compact/decrypt.d.ts", + "bun": "./dist/browser/jwe/compact/decrypt.js", + "deno": "./dist/browser/jwe/compact/decrypt.js", + "browser": "./dist/browser/jwe/compact/decrypt.js", + "worker": "./dist/browser/jwe/compact/decrypt.js", + "workerd": "./dist/browser/jwe/compact/decrypt.js", + "import": "./dist/node/esm/jwe/compact/decrypt.js", + "require": "./dist/node/cjs/jwe/compact/decrypt.js" + }, + "./jwe/flattened/encrypt": { + "types": "./dist/types/jwe/flattened/encrypt.d.ts", + "bun": "./dist/browser/jwe/flattened/encrypt.js", + "deno": "./dist/browser/jwe/flattened/encrypt.js", + "browser": "./dist/browser/jwe/flattened/encrypt.js", + "worker": "./dist/browser/jwe/flattened/encrypt.js", + "workerd": "./dist/browser/jwe/flattened/encrypt.js", + "import": "./dist/node/esm/jwe/flattened/encrypt.js", + "require": "./dist/node/cjs/jwe/flattened/encrypt.js" + }, + "./jwe/flattened/decrypt": { + "types": "./dist/types/jwe/flattened/decrypt.d.ts", + "bun": "./dist/browser/jwe/flattened/decrypt.js", + "deno": "./dist/browser/jwe/flattened/decrypt.js", + "browser": "./dist/browser/jwe/flattened/decrypt.js", + "worker": "./dist/browser/jwe/flattened/decrypt.js", + "workerd": "./dist/browser/jwe/flattened/decrypt.js", + "import": "./dist/node/esm/jwe/flattened/decrypt.js", + "require": "./dist/node/cjs/jwe/flattened/decrypt.js" + }, + "./jwe/general/encrypt": { + "types": "./dist/types/jwe/general/encrypt.d.ts", + "bun": "./dist/browser/jwe/general/encrypt.js", + "deno": "./dist/browser/jwe/general/encrypt.js", + "browser": "./dist/browser/jwe/general/encrypt.js", + "worker": "./dist/browser/jwe/general/encrypt.js", + "workerd": "./dist/browser/jwe/general/encrypt.js", + "import": "./dist/node/esm/jwe/general/encrypt.js", + "require": "./dist/node/cjs/jwe/general/encrypt.js" + }, + "./jwe/general/decrypt": { + "types": "./dist/types/jwe/general/decrypt.d.ts", + "bun": "./dist/browser/jwe/general/decrypt.js", + "deno": "./dist/browser/jwe/general/decrypt.js", + "browser": "./dist/browser/jwe/general/decrypt.js", + "worker": "./dist/browser/jwe/general/decrypt.js", + "workerd": "./dist/browser/jwe/general/decrypt.js", + "import": "./dist/node/esm/jwe/general/decrypt.js", + "require": "./dist/node/cjs/jwe/general/decrypt.js" + }, "./errors": { "types": "./dist/types/util/errors.d.ts", "bun": "./dist/browser/util/errors.js", diff --git a/src/jwe/compact/decrypt.ts b/src/jwe/compact/decrypt.ts index 98b67fea26..19428f22b7 100644 --- a/src/jwe/compact/decrypt.ts +++ b/src/jwe/compact/decrypt.ts @@ -21,6 +21,9 @@ export interface CompactDecryptGetKey /** * Decrypts a Compact JWE. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwe/compact/decrypt'`. + * * @example * * ```js diff --git a/src/jwe/compact/encrypt.ts b/src/jwe/compact/encrypt.ts index 5396692dac..26d4d75572 100644 --- a/src/jwe/compact/encrypt.ts +++ b/src/jwe/compact/encrypt.ts @@ -9,6 +9,9 @@ import type { /** * The CompactEncrypt class is used to build and encrypt Compact JWE strings. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jwe/compact/encrypt'`. + * * @example * * ```js diff --git a/src/jwe/flattened/decrypt.ts b/src/jwe/flattened/decrypt.ts index 3b8d92027d..831d1c584b 100644 --- a/src/jwe/flattened/decrypt.ts +++ b/src/jwe/flattened/decrypt.ts @@ -29,6 +29,9 @@ export interface FlattenedDecryptGetKey /** * Decrypts a Flattened JWE. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwe/flattened/decrypt'`. + * * @example * * ```js diff --git a/src/jwe/flattened/encrypt.ts b/src/jwe/flattened/encrypt.ts index e8785f986a..77c5e243b1 100644 --- a/src/jwe/flattened/encrypt.ts +++ b/src/jwe/flattened/encrypt.ts @@ -1,4 +1,5 @@ import { encode as base64url } from '../../runtime/base64url.js' +import { unprotected } from '../../lib/private_symbols.js' import encrypt from '../../runtime/encrypt.js' import type { @@ -14,12 +15,12 @@ import isDisjoint from '../../lib/is_disjoint.js' import { encoder, decoder, concat } from '../../lib/buffer_utils.js' import validateCrit from '../../lib/validate_crit.js' -/** @private */ -export const unprotected = Symbol() - /** * The FlattenedEncrypt class is used to build and encrypt Flattened JWE objects. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jwe/flattened/encrypt'`. + * * @example * * ```js diff --git a/src/jwe/general/decrypt.ts b/src/jwe/general/decrypt.ts index c194917f5c..2d3128d120 100644 --- a/src/jwe/general/decrypt.ts +++ b/src/jwe/general/decrypt.ts @@ -21,6 +21,9 @@ export interface GeneralDecryptGetKey extends GetKeyFunction { /** * Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwk/thumbprint'`. + * * @example * * ```js @@ -86,6 +89,9 @@ export async function calculateJwkThumbprint( /** * Calculates a JSON Web Key (JWK) Thumbprint URI * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwk/thumbprint'`. + * * @example * * ```js diff --git a/src/jwks/local.ts b/src/jwks/local.ts index 46adb7b333..010b67e349 100644 --- a/src/jwks/local.ts +++ b/src/jwks/local.ts @@ -186,6 +186,9 @@ async function importWithAlgCache( * Note: The function's purpose is to resolve public keys used for verifying signatures and will not * 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'`. + * * @example * * ```js diff --git a/src/jwks/remote.ts b/src/jwks/remote.ts index 849903c891..4c4979a27f 100644 --- a/src/jwks/remote.ts +++ b/src/jwks/remote.ts @@ -275,6 +275,9 @@ class RemoteJWKSet { * Note: The function's purpose is to resolve public keys used for verifying signatures and will not * 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'`. + * * @example * * ```js diff --git a/src/jws/compact/sign.ts b/src/jws/compact/sign.ts index 18c5aef5b5..3550bf0354 100644 --- a/src/jws/compact/sign.ts +++ b/src/jws/compact/sign.ts @@ -4,6 +4,9 @@ import type { CompactJWSHeaderParameters, KeyLike, SignOptions } from '../../typ /** * The CompactSign class is used to build and sign Compact JWS strings. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jws/compact/sign'`. + * * @example * * ```js diff --git a/src/jws/compact/verify.ts b/src/jws/compact/verify.ts index cf60caeb75..00f746180a 100644 --- a/src/jws/compact/verify.ts +++ b/src/jws/compact/verify.ts @@ -23,6 +23,9 @@ export interface CompactVerifyGetKey /** * Verifies the signature and format of and afterwards decodes the Compact JWS. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jws/compact/verify'`. + * * @example * * ```js diff --git a/src/jws/flattened/sign.ts b/src/jws/flattened/sign.ts index 934324bd5c..0332326721 100644 --- a/src/jws/flattened/sign.ts +++ b/src/jws/flattened/sign.ts @@ -11,6 +11,9 @@ import validateCrit from '../../lib/validate_crit.js' /** * The FlattenedSign class is used to build and sign Flattened JWS objects. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jws/flattened/sign'`. + * * @example * * ```js diff --git a/src/jws/flattened/verify.ts b/src/jws/flattened/verify.ts index 3cc5e2cdd1..bdb9af1433 100644 --- a/src/jws/flattened/verify.ts +++ b/src/jws/flattened/verify.ts @@ -31,6 +31,9 @@ export interface FlattenedVerifyGetKey /** * Verifies the signature and format of and afterwards decodes the Flattened JWS. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jws/flattened/verify'`. + * * @example * * ```js diff --git a/src/jws/general/sign.ts b/src/jws/general/sign.ts index a4523d616d..4b5f8bca68 100644 --- a/src/jws/general/sign.ts +++ b/src/jws/general/sign.ts @@ -74,6 +74,9 @@ class IndividualSignature implements Signature { /** * The GeneralSign class is used to build and sign General JWS objects. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jws/general/sign'`. + * * @example * * ```js diff --git a/src/jws/general/verify.ts b/src/jws/general/verify.ts index f2cf013c01..7d90d66225 100644 --- a/src/jws/general/verify.ts +++ b/src/jws/general/verify.ts @@ -24,6 +24,9 @@ export interface GeneralVerifyGetKey /** * Verifies the signature and format of and afterwards decodes the General JWS. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jws/general/verify'`. + * * @example * * ```js diff --git a/src/jwt/decrypt.ts b/src/jwt/decrypt.ts index 6e045e603b..505e07db81 100644 --- a/src/jwt/decrypt.ts +++ b/src/jwt/decrypt.ts @@ -27,6 +27,9 @@ export interface JWTDecryptGetKey * Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT * Claims Set. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwt/decrypt'`. + * * @example * * ```js diff --git a/src/jwt/encrypt.ts b/src/jwt/encrypt.ts index ce6a35b0ed..9193098a52 100644 --- a/src/jwt/encrypt.ts +++ b/src/jwt/encrypt.ts @@ -11,6 +11,9 @@ import { ProduceJWT } from './produce.js' /** * The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jwt/encrypt'`. + * * @example * * ```js diff --git a/src/jwt/sign.ts b/src/jwt/sign.ts index 3809c29400..bc7b1b7aeb 100644 --- a/src/jwt/sign.ts +++ b/src/jwt/sign.ts @@ -7,6 +7,9 @@ import { ProduceJWT } from './produce.js' /** * The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jwt/sign'`. + * * @example * * Usage with a symmetric secret diff --git a/src/jwt/unsecured.ts b/src/jwt/unsecured.ts index bcfc0a7a50..b806e912e5 100644 --- a/src/jwt/unsecured.ts +++ b/src/jwt/unsecured.ts @@ -14,6 +14,9 @@ export interface UnsecuredResult { /** * The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs. * + * This class is exported (as a named export) from the main `'jose'` module entry point as well as + * from its subpath export `'jose/jwt/unsecured'`. + * * @example * * Encoding diff --git a/src/jwt/verify.ts b/src/jwt/verify.ts index eca0599b86..cdcd991114 100644 --- a/src/jwt/verify.ts +++ b/src/jwt/verify.ts @@ -28,6 +28,9 @@ export interface JWTVerifyGetKey extends GetKeyFunction { * Exports a runtime-specific private key representation (KeyObject or 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'`. + * * @example * * ```js @@ -43,6 +49,9 @@ export async function exportPKCS8(key: KeyLike): Promise { /** * Exports a runtime-specific key representation (KeyLike) 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'`. + * * @example * * ```js diff --git a/src/key/generate_key_pair.ts b/src/key/generate_key_pair.ts index c12c1aaef5..08a897e786 100644 --- a/src/key/generate_key_pair.ts +++ b/src/key/generate_key_pair.ts @@ -49,6 +49,9 @@ export interface GenerateKeyPairOptions { * `false` by default. See {@link GenerateKeyPairOptions.extractable} to generate an extractable * `privateKey`. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/generate/keypair'`. + * * @example * * ```js diff --git a/src/key/generate_secret.ts b/src/key/generate_secret.ts index 5d854eefc1..eb4d245569 100644 --- a/src/key/generate_secret.ts +++ b/src/key/generate_secret.ts @@ -17,6 +17,9 @@ export interface GenerateSecretOptions { * Note: Under Web Crypto API runtime 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'`. + * * @example * * ```js diff --git a/src/key/import.ts b/src/key/import.ts index aaab898c58..28eee778d0 100644 --- a/src/key/import.ts +++ b/src/key/import.ts @@ -23,6 +23,9 @@ export interface PEMImportOptions { * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption * (1.2.840.113549.1.1.1) instead for all RSA algorithms. * + * 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'`. + * * @example * * ```js @@ -59,6 +62,9 @@ export async function importSPKI( * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption * (1.2.840.113549.1.1.1) instead for all RSA algorithms. * + * 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'`. + * * @example * * ```js @@ -101,6 +107,9 @@ export async function importX509( * {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption * (1.2.840.113549.1.1.1) instead for all RSA algorithms. * + * 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'`. + * * @example * * ```js @@ -137,6 +146,9 @@ export async function importPKCS8( * Note: When the runtime is using {@link https://w3c.github.io/webcrypto/ Web Cryptography API} the * jwk parameters "use", "key_ops", and "ext" are also used in the resulting `CryptoKey`. * + * 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'`. + * * @example * * ```js diff --git a/src/lib/private_symbols.ts b/src/lib/private_symbols.ts new file mode 100644 index 0000000000..5cb1e2b394 --- /dev/null +++ b/src/lib/private_symbols.ts @@ -0,0 +1 @@ +export const unprotected = Symbol() diff --git a/src/util/decode_jwt.ts b/src/util/decode_jwt.ts index c9d439563a..954f53bc55 100644 --- a/src/util/decode_jwt.ts +++ b/src/util/decode_jwt.ts @@ -10,6 +10,9 @@ import { JWTInvalid } from './errors.js' * and JWS signature verification use `jose.jwtVerify()`. For an encrypted JWT Claims Set validation * and JWE decryption use `jose.jwtDecrypt()`. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/jwt/decode'`. + * * @example * * ```js diff --git a/src/util/decode_protected_header.ts b/src/util/decode_protected_header.ts index cc2ece99b7..6357e2ba3e 100644 --- a/src/util/decode_protected_header.ts +++ b/src/util/decode_protected_header.ts @@ -8,6 +8,9 @@ export type ProtectedHeaderParameters = JWSHeaderParameters & JWEHeaderParameter /** * Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serialization. * + * This function is exported (as a named export) from the main `'jose'` module entry point as well + * as from its subpath export `'jose/decode/protected_header'`. + * * @example * * ```js