diff --git a/docs/classes/jwe_compact_encrypt.CompactEncrypt.md b/docs/classes/jwe_compact_encrypt.CompactEncrypt.md index aa8c558c..009f221d 100644 --- a/docs/classes/jwe_compact_encrypt.CompactEncrypt.md +++ b/docs/classes/jwe_compact_encrypt.CompactEncrypt.md @@ -6,28 +6,13 @@ The CompactEncrypt class is a utility for creating Compact JWE strings. ```js const encoder = new TextEncoder() -const jwe = await new CompactEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const jwe = await new jose.CompactEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' }) .encrypt(publicKey) console.log(jwe) ``` -**`example`** ESM import -```js -import { CompactEncrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { CompactEncrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { CompactEncrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md b/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md index 394813d4..b2e79ca3 100644 --- a/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md +++ b/docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md @@ -7,7 +7,7 @@ objects. ```js const encoder = new TextEncoder() -const jwe = await new FlattenedEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const jwe = await new jose.FlattenedEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' }) .setAdditionalAuthenticatedData(encoder.encode('The Fellowship of the Ring')) .encrypt(publicKey) @@ -15,21 +15,6 @@ const jwe = await new FlattenedEncrypt(encoder.encode('It’s a dangerous busine console.log(jwe) ``` -**`example`** ESM import -```js -import { FlattenedEncrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { FlattenedEncrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { FlattenedEncrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jwe_general_encrypt.GeneralEncrypt.md b/docs/classes/jwe_general_encrypt.GeneralEncrypt.md index 9b5522cb..d8d46910 100644 --- a/docs/classes/jwe_general_encrypt.GeneralEncrypt.md +++ b/docs/classes/jwe_general_encrypt.GeneralEncrypt.md @@ -6,7 +6,7 @@ The GeneralEncrypt class is a utility for creating General JWE objects. ```js const encoder = new TextEncoder() -const encrypt = new GeneralEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const encrypt = new jose.GeneralEncrypt(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) .setProtectedHeader({ enc: 'A256GCM' }) encrypt @@ -20,21 +20,6 @@ encrypt const jwe = await encrypt.encrypt() ``` -**`example`** ESM import -```js -import { GeneralEncrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { GeneralEncrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { GeneralEncrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jws_compact_sign.CompactSign.md b/docs/classes/jws_compact_sign.CompactSign.md index 870cce3a..2d7ce16c 100644 --- a/docs/classes/jws_compact_sign.CompactSign.md +++ b/docs/classes/jws_compact_sign.CompactSign.md @@ -6,28 +6,13 @@ The CompactSign class is a utility for creating Compact JWS strings. ```js const encoder = new TextEncoder() -const jws = await new CompactSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const jws = await new jose.CompactSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) .setProtectedHeader({ alg: 'ES256' }) .sign(privateKey) console.log(jws) ``` -**`example`** ESM import -```js -import { CompactSign } from 'jose' -``` - -**`example`** CJS import -```js -const { CompactSign } = require('jose') -``` - -**`example`** Deno import -```js -import { CompactSign } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jws_flattened_sign.FlattenedSign.md b/docs/classes/jws_flattened_sign.FlattenedSign.md index c0dd3505..95ab71a1 100644 --- a/docs/classes/jws_flattened_sign.FlattenedSign.md +++ b/docs/classes/jws_flattened_sign.FlattenedSign.md @@ -6,27 +6,12 @@ The FlattenedSign class is a utility for creating Flattened JWS objects. ```js const encoder = new TextEncoder() -const jws = await new FlattenedSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const jws = await new jose.FlattenedSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) .setProtectedHeader({ alg: 'ES256' }) .sign(privateKey) console.log(jws) ``` -**`example`** ESM import -```js -import { FlattenedSign } from 'jose' -``` - -**`example`** CJS import -```js -const { FlattenedSign } = require('jose') -``` - -**`example`** Deno import -```js -import { FlattenedSign } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jws_general_sign.GeneralSign.md b/docs/classes/jws_general_sign.GeneralSign.md index 34d7d7a2..88f4669a 100644 --- a/docs/classes/jws_general_sign.GeneralSign.md +++ b/docs/classes/jws_general_sign.GeneralSign.md @@ -6,7 +6,7 @@ The GeneralSign class is a utility for creating General JWS objects. ```js const encoder = new TextEncoder() -const sign = new GeneralSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) +const sign = new jose.GeneralSign(encoder.encode('It’s a dangerous business, Frodo, going out your door.')) sign .addSignature(ecPrivateKey) @@ -19,21 +19,6 @@ sign const jws = await sign.sign() ``` -**`example`** ESM import -```js -import { GeneralSign } from 'jose' -``` - -**`example`** CJS import -```js -const { GeneralSign } = require('jose') -``` - -**`example`** Deno import -```js -import { GeneralSign } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jwt_encrypt.EncryptJWT.md b/docs/classes/jwt_encrypt.EncryptJWT.md index d84eddfe..e29f6e2e 100644 --- a/docs/classes/jwt_encrypt.EncryptJWT.md +++ b/docs/classes/jwt_encrypt.EncryptJWT.md @@ -4,7 +4,7 @@ The EncryptJWT class is a utility for creating Compact JWE formatted JWT strings **`example`** Usage ```js -const jwt = await new EncryptJWT({ 'urn:example:claim': true }) +const jwt = await new jose.EncryptJWT({ 'urn:example:claim': true }) .setProtectedHeader({ alg: 'dir', enc: 'A256GCM' }) .setIssuedAt() .setIssuer('urn:example:issuer') @@ -15,21 +15,6 @@ const jwt = await new EncryptJWT({ 'urn:example:claim': true }) console.log(jwt) ``` -**`example`** ESM import -```js -import { EncryptJWT } from 'jose' -``` - -**`example`** CJS import -```js -const { EncryptJWT } = require('jose') -``` - -**`example`** Deno import -```js -import { EncryptJWT } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jwt_sign.SignJWT.md b/docs/classes/jwt_sign.SignJWT.md index 675a98aa..a714101d 100644 --- a/docs/classes/jwt_sign.SignJWT.md +++ b/docs/classes/jwt_sign.SignJWT.md @@ -4,7 +4,7 @@ The SignJWT class is a utility for creating Compact JWS formatted JWT strings. **`example`** Usage ```js -const jwt = await new SignJWT({ 'urn:example:claim': true }) +const jwt = await new jose.SignJWT({ 'urn:example:claim': true }) .setProtectedHeader({ alg: 'ES256' }) .setIssuedAt() .setIssuer('urn:example:issuer') @@ -15,21 +15,6 @@ const jwt = await new SignJWT({ 'urn:example:claim': true }) console.log(jwt) ``` -**`example`** ESM import -```js -import { SignJWT } from 'jose' -``` - -**`example`** CJS import -```js -const { SignJWT } = require('jose') -``` - -**`example`** Deno import -```js -import { SignJWT } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/classes/jwt_unsecured.UnsecuredJWT.md b/docs/classes/jwt_unsecured.UnsecuredJWT.md index 5be18fb6..c2227702 100644 --- a/docs/classes/jwt_unsecured.UnsecuredJWT.md +++ b/docs/classes/jwt_unsecured.UnsecuredJWT.md @@ -4,7 +4,7 @@ The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecur **`example`** Encoding ```js * -const unsecuredJwt = new UnsecuredJWT({ 'urn:example:claim': true }) +const unsecuredJwt = new jose.UnsecuredJWT({ 'urn:example:claim': true }) .setIssuedAt() .setIssuer('urn:example:issuer') .setAudience('urn:example:audience') @@ -16,7 +16,7 @@ console.log(unsecuredJwt) **`example`** Decoding ```js * -const payload = new UnsecuredJWT.decode(jwt, { +const payload = new jose.UnsecuredJWT.decode(jwt, { issuer: 'urn:example:issuer', audience: 'urn:example:audience' }) @@ -24,21 +24,6 @@ const payload = new UnsecuredJWT.decode(jwt, { console.log(payload) ``` -**`example`** ESM import -```js -import { UnsecuredJWT } from 'jose' -``` - -**`example`** CJS import -```js -const { UnsecuredJWT } = require('jose') -``` - -**`example`** Deno import -```js -import { UnsecuredJWT } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - ## Table of contents ### Constructors diff --git a/docs/functions/jwe_compact_decrypt.compactDecrypt.md b/docs/functions/jwe_compact_decrypt.compactDecrypt.md index d7bab2f5..70fbfffa 100644 --- a/docs/functions/jwe_compact_decrypt.compactDecrypt.md +++ b/docs/functions/jwe_compact_decrypt.compactDecrypt.md @@ -9,27 +9,12 @@ Decrypts a Compact JWE. const decoder = new TextDecoder() const jwe = 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0.nyQ19eq9ogh9wA7fFtnI2oouzy5_8b5DeLkoRMfi2yijgfTs2zEnayCEofz_qhnL-nwszabd9qUeHv0-IwvhhJJS7GUJOU3ikiIe42qcIAFme1A_Fo9CTxw4XTOy-I5qanl8So91u6hwfyN1VxAqVLsSE7_23EC-gfGEg_5znew9PyXXsOIE-K_HH7IQowRrlZ1X_bM_Liu53RzDpLDvRz59mp3S8L56YqpM8FexFGTGpEaoTcEIst375qncYt3-79IVR7gZN1RWsWgjPatfvVbnh74PglQcATSf3UUhaW0OAKn6q7r3PDx6DIKQ35bgHQg5QopuN00eIfLQL2trGw.W3grIVj5HVuAb76X.6PcuDe5D6ttWFYyv0oqqdDXfI2R8wBg1F2Q80UUA_Gv8eEimNWfxIWdLxrjzgQGSvIhxmFKuLM0.a93_Ug3uZHuczj70Zavx8Q' -const { plaintext, protectedHeader } = await compactDecrypt(jwe, privateKey) +const { plaintext, protectedHeader } = await jose.compactDecrypt(jwe, privateKey) console.log(protectedHeader) console.log(decoder.decode(plaintext)) ``` -**`example`** ESM import -```js -import { compactDecrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { compactDecrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { compactDecrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md b/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md index 08085e89..852260e1 100644 --- a/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md +++ b/docs/functions/jwe_flattened_decrypt.flattenedDecrypt.md @@ -20,28 +20,13 @@ const { plaintext, protectedHeader, additionalAuthenticatedData -} = await flattenedDecrypt(jwe, privateKey) +} = await jose.flattenedDecrypt(jwe, privateKey) console.log(protectedHeader) console.log(decoder.decode(plaintext)) console.log(decoder.decode(additionalAuthenticatedData)) ``` -**`example`** ESM import -```js -import { flattenedDecrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { flattenedDecrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { flattenedDecrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwe_general_decrypt.generalDecrypt.md b/docs/functions/jwe_general_decrypt.generalDecrypt.md index fa99f9c0..327cd7eb 100644 --- a/docs/functions/jwe_general_decrypt.generalDecrypt.md +++ b/docs/functions/jwe_general_decrypt.generalDecrypt.md @@ -4,21 +4,6 @@ Decrypts a General JWE. -**`example`** ESM import -```js -import { generalDecrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { generalDecrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { generalDecrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - **`example`** Usage ```js const decoder = new TextDecoder() @@ -39,7 +24,7 @@ const { plaintext, protectedHeader, additionalAuthenticatedData -} = await generalDecrypt(jwe, privateKey) +} = await jose.generalDecrypt(jwe, privateKey) console.log(protectedHeader) console.log(decoder.decode(plaintext)) diff --git a/docs/functions/jwk_embedded.EmbeddedJWK.md b/docs/functions/jwk_embedded.EmbeddedJWK.md index 1e6c68b9..110f1f8b 100644 --- a/docs/functions/jwk_embedded.EmbeddedJWK.md +++ b/docs/functions/jwk_embedded.EmbeddedJWK.md @@ -10,11 +10,9 @@ JWS algorithms to accept. **`example`** Usage ```js -import { jwtVerify } from 'jose' - const jwt = 'eyJqd2siOnsiY3J2IjoiUC0yNTYiLCJ4IjoiVU05ZzVuS25aWFlvdldBbE03NmNMejl2VG96UmpfX0NIVV9kT2wtZ09vRSIsInkiOiJkczhhZVF3MWwyY0RDQTdiQ2tPTnZ3REtwWEFidFhqdnFDbGVZSDhXc19VIiwia3R5IjoiRUMifSwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSIsImlhdCI6MTYwNDU4MDc5NH0.60boak3_dErnW47ZPty1C0nrjeVq86EN_eK0GOq6K8w2OA0thKoBxFK4j-NuU9yZ_A9UKGxPT_G87DladBaV9g' -const { payload, protectedHeader } = await jwtVerify(jwt, EmbeddedJWK, { +const { payload, protectedHeader } = await jose.jwtVerify(jwt, jose.EmbeddedJWK, { issuer: 'urn:example:issuer', audience: 'urn:example:audience' }) @@ -23,21 +21,6 @@ console.log(protectedHeader) console.log(payload) ``` -**`example`** ESM import -```js -import { EmbeddedJWK } from 'jose' -``` - -**`example`** CJS import -```js -const { EmbeddedJWK } = require('jose') -``` - -**`example`** Deno import -```js -import { EmbeddedJWK } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | diff --git a/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md b/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md index 09e8bb90..36d15f0a 100644 --- a/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md +++ b/docs/functions/jwk_thumbprint.calculateJwkThumbprint.md @@ -7,7 +7,7 @@ Calculates a base64url-encoded JSON Web Key (JWK) Thumbprint as per **`example`** Usage ```js -const thumbprint = await calculateJwkThumbprint({ +const thumbprint = await jose.calculateJwkThumbprint({ kty: 'RSA', e: 'AQAB', n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ' @@ -16,21 +16,6 @@ const thumbprint = await calculateJwkThumbprint({ console.log(thumbprint) ``` -**`example`** ESM import -```js -import { calculateJwkThumbprint } from 'jose' -``` - -**`example`** CJS import -```js -const { calculateJwkThumbprint } = require('jose') -``` - -**`example`** Deno import -```js -import { calculateJwkThumbprint } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Default value | Description | diff --git a/docs/functions/jwks_remote.createRemoteJWKSet.md b/docs/functions/jwks_remote.createRemoteJWKSet.md index a67612bc..d6608fb2 100644 --- a/docs/functions/jwks_remote.createRemoteJWKSet.md +++ b/docs/functions/jwks_remote.createRemoteJWKSet.md @@ -9,11 +9,9 @@ the selection process. **`example`** Usage ```js -import { jwtVerify } from 'jose' +const JWKS = jose.createRemoteJWKSet(new URL('https://www.googleapis.com/oauth2/v3/certs')) -const JWKS = createRemoteJWKSet(new URL('https://www.googleapis.com/oauth2/v3/certs')) - -const { payload, protectedHeader } = await jwtVerify(jwt, JWKS, { +const { payload, protectedHeader } = await jose.jwtVerify(jwt, JWKS, { issuer: 'urn:example:issuer', audience: 'urn:example:audience' }) @@ -21,21 +19,6 @@ console.log(protectedHeader) console.log(payload) ``` -**`example`** ESM import -```js -import { createRemoteJWKSet } from 'jose' -``` - -**`example`** CJS import -```js -const { createRemoteJWKSet } = require('jose') -``` - -**`example`** Deno import -```js -import { createRemoteJWKSet } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jws_compact_verify.compactVerify.md b/docs/functions/jws_compact_verify.compactVerify.md index 8dd1091d..898b461c 100644 --- a/docs/functions/jws_compact_verify.compactVerify.md +++ b/docs/functions/jws_compact_verify.compactVerify.md @@ -9,27 +9,12 @@ Verifies the signature and format of and afterwards decodes the Compact JWS. const decoder = new TextDecoder() const jws = 'eyJhbGciOiJFUzI1NiJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4.kkAs_gPPxWMI3rHuVlxHaTPfDWDoqdI8jSvuSmqV-8IHIWXg9mcAeC9ggV-45ZHRbiRJ3obUIFo1rHphPA5URg' -const { payload, protectedHeader } = await compactVerify(jws, publicKey) +const { payload, protectedHeader } = await jose.compactVerify(jws, publicKey) console.log(protectedHeader) console.log(decoder.decode(payload)) ``` -**`example`** ESM import -```js -import { compactVerify } from 'jose' -``` - -**`example`** CJS import -```js -const { compactVerify } = require('jose') -``` - -**`example`** Deno import -```js -import { compactVerify } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jws_flattened_verify.flattenedVerify.md b/docs/functions/jws_flattened_verify.flattenedVerify.md index 2cf4c539..ee50d266 100644 --- a/docs/functions/jws_flattened_verify.flattenedVerify.md +++ b/docs/functions/jws_flattened_verify.flattenedVerify.md @@ -13,27 +13,12 @@ const jws = { protected: 'eyJhbGciOiJFUzI1NiJ9' } -const { payload, protectedHeader } = await flattenedVerify(jws, publicKey) +const { payload, protectedHeader } = await jose.flattenedVerify(jws, publicKey) console.log(protectedHeader) console.log(decoder.decode(payload)) ``` -**`example`** ESM import -```js -import { flattenedVerify } from 'jose' -``` - -**`example`** CJS import -```js -const { flattenedVerify } = require('jose') -``` - -**`example`** Deno import -```js -import { flattenedVerify } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jws_general_verify.generalVerify.md b/docs/functions/jws_general_verify.generalVerify.md index e85aaa62..629b6343 100644 --- a/docs/functions/jws_general_verify.generalVerify.md +++ b/docs/functions/jws_general_verify.generalVerify.md @@ -17,27 +17,12 @@ const jws = { ] } -const { payload, protectedHeader } = await generalVerify(jws, publicKey) +const { payload, protectedHeader } = await jose.generalVerify(jws, publicKey) console.log(protectedHeader) console.log(decoder.decode(payload)) ``` -**`example`** ESM import -```js -import { generalVerify } from 'jose' -``` - -**`example`** CJS import -```js -const { generalVerify } = require('jose') -``` - -**`example`** Deno import -```js -import { generalVerify } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwt_decrypt.jwtDecrypt.md b/docs/functions/jwt_decrypt.jwtDecrypt.md index 44ea6c28..35c27977 100644 --- a/docs/functions/jwt_decrypt.jwtDecrypt.md +++ b/docs/functions/jwt_decrypt.jwtDecrypt.md @@ -8,7 +8,7 @@ Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, v ```js const jwt = 'eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..KVcNLqK-3-8ZkYIC.xSwF4VxO0kUMUD2W-cifsNUxnr-swyBq-nADBptyt6y9n79-iNc5b0AALJpRwc0wwDkJw8hNOMjApNUTMsK9b-asToZ3DXFMvwfJ6n1aWefvd7RsoZ2LInWFfVAuttJDzoGB.uuexQoWHwrLMEYRElT8pBQ' -const { payload, protectedHeader } = await jwtDecrypt(jwt, secretKey, { +const { payload, protectedHeader } = await jose.jwtDecrypt(jwt, secretKey, { issuer: 'urn:example:issuer', audience: 'urn:example:audience' }) @@ -17,21 +17,6 @@ console.log(protectedHeader) console.log(payload) ``` -**`example`** ESM import -```js -import { jwtDecrypt } from 'jose' -``` - -**`example`** CJS import -```js -const { jwtDecrypt } = require('jose') -``` - -**`example`** Deno import -```js -import { jwtDecrypt } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/jwt_verify.jwtVerify.md b/docs/functions/jwt_verify.jwtVerify.md index b1b5d2d1..1c2c66c2 100644 --- a/docs/functions/jwt_verify.jwtVerify.md +++ b/docs/functions/jwt_verify.jwtVerify.md @@ -8,7 +8,7 @@ Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature ```js const jwt = 'eyJhbGciOiJFUzI1NiJ9.eyJ1cm46ZXhhbXBsZTpjbGFpbSI6dHJ1ZSwiaWF0IjoxNjA0MzE1MDc0LCJpc3MiOiJ1cm46ZXhhbXBsZTppc3N1ZXIiLCJhdWQiOiJ1cm46ZXhhbXBsZTphdWRpZW5jZSJ9.hx1nOfAT5LlXuzu8O-bhjXBGpklWDt2EsHw7-MDn49NrnwvVsstNhEnkW2ddauB7eSikFtUNeumLpFI9CWDBsg' -const { payload, protectedHeader } = await jwtVerify(jwt, publicKey, { +const { payload, protectedHeader } = await jose.jwtVerify(jwt, publicKey, { issuer: 'urn:example:issuer', audience: 'urn:example:audience' }) @@ -17,21 +17,6 @@ console.log(protectedHeader) console.log(payload) ``` -**`example`** ESM import -```js -import { jwtVerify } from 'jose' -``` - -**`example`** CJS import -```js -const { jwtVerify } = require('jose') -``` - -**`example`** Deno import -```js -import { jwtVerify } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_export.exportJWK.md b/docs/functions/key_export.exportJWK.md index 6d0d4c49..c92e8134 100644 --- a/docs/functions/key_export.exportJWK.md +++ b/docs/functions/key_export.exportJWK.md @@ -6,28 +6,13 @@ Exports a runtime-specific key representation (KeyLike) to a JWK. **`example`** Usage ```js -const privateJwk = await exportJWK(privateKey) -const publicJwk = await exportJWK(publicKey) +const privateJwk = await jose.exportJWK(privateKey) +const publicJwk = await jose.exportJWK(publicKey) console.log(privateJwk) console.log(publicJwk) ``` -**`example`** ESM import -```js -import { exportJWK } from 'jose' -``` - -**`example`** CJS import -```js -const { exportJWK } = require('jose') -``` - -**`example`** Deno import -```js -import { exportJWK } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_export.exportPKCS8.md b/docs/functions/key_export.exportPKCS8.md index 4cfff421..c7ee1d59 100644 --- a/docs/functions/key_export.exportPKCS8.md +++ b/docs/functions/key_export.exportPKCS8.md @@ -6,26 +6,11 @@ Exports a runtime-specific private key representation (KeyObject or CryptoKey) t **`example`** Usage ```js -const pkcs8Pem = await exportPKCS8(privateKey) +const pkcs8Pem = await jose.exportPKCS8(privateKey) console.log(pkcs8Pem) ``` -**`example`** ESM import -```js -import { exportPKCS8 } from 'jose' -``` - -**`example`** CJS import -```js -const { exportPKCS8 } = require('jose') -``` - -**`example`** Deno import -```js -import { exportPKCS8 } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_export.exportSPKI.md b/docs/functions/key_export.exportSPKI.md index ec16eca0..8f233234 100644 --- a/docs/functions/key_export.exportSPKI.md +++ b/docs/functions/key_export.exportSPKI.md @@ -6,26 +6,11 @@ Exports a runtime-specific public key representation (KeyObject or CryptoKey) to **`example`** Usage ```js -const spkiPem = await exportSPKI(publicKey) +const spkiPem = await jose.exportSPKI(publicKey) console.log(spkiPem) ``` -**`example`** ESM import -```js -import { exportSPKI } from 'jose' -``` - -**`example`** CJS import -```js -const { exportSPKI } = require('jose') -``` - -**`example`** Deno import -```js -import { exportSPKI } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### 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 e44ddf86..61fc2b6d 100644 --- a/docs/functions/key_generate_key_pair.generateKeyPair.md +++ b/docs/functions/key_generate_key_pair.generateKeyPair.md @@ -11,26 +11,11 @@ Note: Under Web Cryptography API runtime the `privateKey` is generated with **`example`** Usage ```js -const { publicKey, privateKey } = await generateKeyPair('PS256') +const { publicKey, privateKey } = await jose.generateKeyPair('PS256') console.log(publicKey) console.log(privateKey) ``` -**`example`** ESM import -```js -import { generateKeyPair } from 'jose' -``` - -**`example`** CJS import -```js -const { generateKeyPair } = require('jose') -``` - -**`example`** Deno import -```js -import { generateKeyPair } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_generate_secret.generateSecret.md b/docs/functions/key_generate_secret.generateSecret.md index a18d3247..bbf30ecc 100644 --- a/docs/functions/key_generate_secret.generateSecret.md +++ b/docs/functions/key_generate_secret.generateSecret.md @@ -9,25 +9,10 @@ Note: Under Web Cryptography API runtime the secret key is generated with **`example`** Usage ```js -const secret = await generateSecret('HS256') +const secret = await jose.generateSecret('HS256') console.log(secret) ``` -**`example`** ESM import -```js -import { generateSecret } from 'jose' -``` - -**`example`** CJS import -```js -const { generateSecret } = require('jose') -``` - -**`example`** Deno import -```js -import { generateSecret } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_import.importJWK.md b/docs/functions/key_import.importJWK.md index a8bfa1d4..e49ddb17 100644 --- a/docs/functions/key_import.importJWK.md +++ b/docs/functions/key_import.importJWK.md @@ -11,35 +11,20 @@ requirements and mapping. **`example`** Usage ```js -const ecPublicKey = await importJWK({ +const ecPublicKey = await jose.importJWK({ crv: 'P-256', kty: 'EC', x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw', y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo' }, 'ES256') -const rsaPublicKey = await importJWK({ +const rsaPublicKey = await jose.importJWK({ kty: 'RSA', e: 'AQAB', n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ' }, 'PS256') ``` -**`example`** ESM import -```js -import { importJWK } from 'jose' -``` - -**`example`** CJS import -```js -const { importJWK } = require('jose') -``` - -**`example`** Deno import -```js -import { importJWK } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/functions/key_import.importPKCS8.md b/docs/functions/key_import.importPKCS8.md index d9a916ed..6fbb6d83 100644 --- a/docs/functions/key_import.importPKCS8.md +++ b/docs/functions/key_import.importPKCS8.md @@ -14,22 +14,7 @@ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiyvo0X+VQ0yIrOaN nlrnUclopnvuuMfoc8HHly3505OhRANCAAQWUcdZ8uTSAsFuwtNy4KtsKqgeqYxg l6kwL5D4N3pEGYGIDjV69Sw0zAt43480WqJv7HCL0mQnyqFmSrxj8jMa -----END PRIVATE KEY-----` -const ecPrivateKey = await importPKCS8(pkcs8, algorithm) -``` - -**`example`** ESM import -```js -import { importPKCS8 } from 'jose' -``` - -**`example`** CJS import -```js -const { importPKCS8 } = require('jose') -``` - -**`example`** Deno import -```js -import { importPKCS8 } from 'https://deno.land/x/jose@v4.2.1/index.ts' +const ecPrivateKey = await jose.importPKCS8(pkcs8, algorithm) ``` #### Parameters diff --git a/docs/functions/key_import.importSPKI.md b/docs/functions/key_import.importSPKI.md index f5f1ba6d..49922afc 100644 --- a/docs/functions/key_import.importSPKI.md +++ b/docs/functions/key_import.importSPKI.md @@ -13,22 +13,7 @@ const spki = `-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg== -----END PUBLIC KEY-----` -const ecPublicKey = await importSPKI(spki, algorithm) -``` - -**`example`** ESM import -```js -import { importSPKI } from 'jose' -``` - -**`example`** CJS import -```js -const { importSPKI } = require('jose') -``` - -**`example`** Deno import -```js -import { importSPKI } from 'https://deno.land/x/jose@v4.2.1/index.ts' +const ecPublicKey = await jose.importSPKI(spki, algorithm) ``` #### Parameters diff --git a/docs/functions/key_import.importX509.md b/docs/functions/key_import.importX509.md index 1578ae14..8a539c53 100644 --- a/docs/functions/key_import.importX509.md +++ b/docs/functions/key_import.importX509.md @@ -19,22 +19,7 @@ UH+kBKDnphJO3odpPZ5gvgKs2nwRWcrDnUjYLDAKBggqhkjOPQQDAgNIADBFAiEA 1yyMTRe66MhEXID9+uVub7woMkNYd0LhSHwKSPMUUTkCIFQGsfm1ecXOpeGOufAh v+A1QWZMuTWqYt+uh/YSRNDn -----END CERTIFICATE-----` -const ecPublicKey = await importX509(x509, algorithm) -``` - -**`example`** ESM import -```js -import { importX509 } from 'jose' -``` - -**`example`** CJS import -```js -const { importX509 } = require('jose') -``` - -**`example`** Deno import -```js -import { importX509 } from 'https://deno.land/x/jose@v4.2.1/index.ts' +const ecPublicKey = await jose.importX509(x509, algorithm) ``` #### Parameters diff --git a/docs/functions/util_decode_protected_header.decodeProtectedHeader.md b/docs/functions/util_decode_protected_header.decodeProtectedHeader.md index 722f9f79..5ffeb1bc 100644 --- a/docs/functions/util_decode_protected_header.decodeProtectedHeader.md +++ b/docs/functions/util_decode_protected_header.decodeProtectedHeader.md @@ -6,25 +6,10 @@ Decodes the Protected Header of a JWE/JWS/JWT token utilizing any JOSE serializa **`example`** Usage ```js -const protectedHeader = decodeProtectedHeader(token) +const protectedHeader = jose.decodeProtectedHeader(token) console.log(protectedHeader) ``` -**`example`** ESM import -```js -import { decodeProtectedHeader } from 'jose' -``` - -**`example`** CJS import -```js -const { decodeProtectedHeader } = require('jose') -``` - -**`example`** Deno import -```js -import { decodeProtectedHeader } from 'https://deno.land/x/jose@v4.2.1/index.ts' -``` - #### Parameters | Name | Type | Description | diff --git a/docs/types/types.KeyLike.md b/docs/types/types.KeyLike.md index 09c39dc5..8199a7af 100644 --- a/docs/types/types.KeyLike.md +++ b/docs/types/types.KeyLike.md @@ -38,20 +38,16 @@ to obtain a CryptoKey from your existing key material. **`example`** Import a PEM-encoded SPKI Public Key ```js -import { importSPKI } from 'jose' - const algorithm = 'ES256' const spki = `-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFlHHWfLk0gLBbsLTcuCrbCqoHqmM YJepMC+Q+Dd6RBmBiA41evUsNMwLeN+PNFqib+xwi9JkJ8qhZkq8Y/IzGg== -----END PUBLIC KEY-----` -const ecPublicKey = await importSPKI(spki, algorithm) +const ecPublicKey = await jose.importSPKI(spki, algorithm) ``` **`example`** Import a X.509 Certificate ```js -import { importX509 } from 'jose' - const algorithm = 'ES256' const x509 = `-----BEGIN CERTIFICATE----- MIIBXjCCAQSgAwIBAgIGAXvykuMKMAoGCCqGSM49BAMCMDYxNDAyBgNVBAMMK3Np @@ -63,34 +59,30 @@ UH+kBKDnphJO3odpPZ5gvgKs2nwRWcrDnUjYLDAKBggqhkjOPQQDAgNIADBFAiEA 1yyMTRe66MhEXID9+uVub7woMkNYd0LhSHwKSPMUUTkCIFQGsfm1ecXOpeGOufAh v+A1QWZMuTWqYt+uh/YSRNDn -----END CERTIFICATE-----` -const ecPublicKey = await importX509(x509, algorithm) +const ecPublicKey = await jose.importX509(x509, algorithm) ``` **`example`** Import a PEM-encoded PKCS8 Private Key ```js -import { importPKCS8 } from 'jose' - const algorithm = 'ES256' const pkcs8 = `-----BEGIN PRIVATE KEY----- MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiyvo0X+VQ0yIrOaN nlrnUclopnvuuMfoc8HHly3505OhRANCAAQWUcdZ8uTSAsFuwtNy4KtsKqgeqYxg l6kwL5D4N3pEGYGIDjV69Sw0zAt43480WqJv7HCL0mQnyqFmSrxj8jMa -----END PRIVATE KEY-----` -const ecPrivateKey = await importPKCS8(pkcs8, algorithm) +const ecPrivateKey = await jose.importPKCS8(pkcs8, algorithm) ``` **`example`** Import a JSON Web Key (JWK) ```js -import { importJWK } from 'jose' - -const ecPublicKey = await importJWK({ +const ecPublicKey = await jose.importJWK({ crv: 'P-256', kty: 'EC', x: 'ySK38C1jBdLwDsNWKzzBHqKYEE5Cgv-qjWvorUXk9fw', y: '_LeQBw07cf5t57Iavn4j-BqJsAD1dpoz8gokd3sBsOo' }, 'ES256') -const rsaPublicKey = await importJWK({ +const rsaPublicKey = await jose.importJWK({ kty: 'RSA', e: 'AQAB', n: '12oBZRhCiZFJLcPg59LkZZ9mdhSMTKAQZYq32k_ti5SBB6jerkh-WzOMAO664r_qyLkqHUSp3u5SbXtseZEpN3XPWGKSxjsy-1JyEFTdLSYe6f9gfrmxkUF_7DTpq0gn6rntP05g2-wFW50YO7mosfdslfrTJYWHFhJALabAeYirYD7-9kqq9ebfFMF4sRRELbv9oi36As6Q9B3Qb5_C1rAzqfao_PCsf9EPsTZsVVVkA5qoIAr47lo1ipfiBPxUCCNSdvkmDTYgvvRm6ZoMjFbvOtgyts55fXKdMWv7I9HMD5HwE9uW839PWA514qhbcIsXEYSFMPMV6fnlsiZvQQ'