Skip to content

Commit

Permalink
docs: update typedoc, format tsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jun 29, 2022
1 parent 3281e68 commit 8b99555
Show file tree
Hide file tree
Showing 121 changed files with 2,086 additions and 1,347 deletions.
7 changes: 6 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100,
"semi": false
"semi": false,
"plugins": ["prettier-plugin-jsdoc"],
"tsdoc": true,
"jsdocSeparateReturnsFromParam": true,
"jsdocSeparateTagGroups": true,
"jsdocPrintWidth": 100
}
28 changes: 13 additions & 15 deletions docs/classes/jwe_compact_encrypt.CompactEncrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
The CompactEncrypt class is a utility for creating Compact JWE strings.

**`example`** Usage

```js
const jwe = await new jose.CompactEncrypt(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
.encrypt(publicKey)
Expand Down Expand Up @@ -68,11 +67,11 @@ ___

**setContentEncryptionKey**(`cek`): [`CompactEncrypt`](jwe_compact_encrypt.CompactEncrypt.md)

Sets a content encryption key to use, by default a random suitable one
is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand All @@ -90,12 +89,11 @@ ___

**setInitializationVector**(`iv`): [`CompactEncrypt`](jwe_compact_encrypt.CompactEncrypt.md)

Sets the JWE Initialization Vector to use for content encryption, by default
a random suitable one is generated for the JWE enc" (Encryption Algorithm)
Header Parameter.
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand All @@ -113,9 +111,9 @@ ___

**setKeyManagementParameters**(`parameters`): [`CompactEncrypt`](jwe_compact_encrypt.CompactEncrypt.md)

Sets the JWE Key Management parameters to be used when encrypting the Content
Encryption Key. You do not need to invoke this method, it is only really
intended for test and vector validation purposes.
Sets the JWE Key Management parameters to be used when encrypting the Content Encryption Key.
You do not need to invoke this method, it is only really intended for test and vector
validation purposes.

#### Parameters

Expand Down
33 changes: 15 additions & 18 deletions docs/classes/jwe_flattened_encrypt.FlattenedEncrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

[💗 Help the project](https://github.com/sponsors/panva)

The FlattenedEncrypt class is a utility for creating Flattened JWE
objects.
The FlattenedEncrypt class is a utility for creating Flattened JWE objects.

**`example`** Usage

```js
const jwe = await new jose.FlattenedEncrypt(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
.setAdditionalAuthenticatedData(encoder.encode('The Fellowship of the Ring'))
Expand Down Expand Up @@ -91,11 +89,11 @@ ___

**setContentEncryptionKey**(`cek`): [`FlattenedEncrypt`](jwe_flattened_encrypt.FlattenedEncrypt.md)

Sets a content encryption key to use, by default a random suitable one
is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand All @@ -113,12 +111,11 @@ ___

**setInitializationVector**(`iv`): [`FlattenedEncrypt`](jwe_flattened_encrypt.FlattenedEncrypt.md)

Sets the JWE Initialization Vector to use for content encryption, by default
a random suitable one is generated for the JWE enc" (Encryption Algorithm)
Header Parameter.
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand All @@ -136,10 +133,10 @@ ___

**setKeyManagementParameters**(`parameters`): [`FlattenedEncrypt`](jwe_flattened_encrypt.FlattenedEncrypt.md)

Sets the JWE Key Management parameters to be used when encrypting.
Use of this is method is really only needed for ECDH based algorithms
when utilizing the Agreement PartyUInfo or Agreement PartyVInfo parameters.
Other parameters will always be randomly generated when needed and missing.
Sets the JWE Key Management parameters to be used when encrypting. Use of this is method is
really only needed for ECDH based algorithms when utilizing the Agreement PartyUInfo or
Agreement PartyVInfo parameters. Other parameters will always be randomly generated when needed
and missing.

#### Parameters

Expand Down
5 changes: 2 additions & 3 deletions docs/classes/jwe_general_encrypt.GeneralEncrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
The GeneralEncrypt class is a utility for creating General JWE objects.

**`example`** Usage

```js
const jwe = await new jose.GeneralEncrypt(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ enc: 'A256GCM' })
.addRecipient(ecPublicKey)
Expand Down
5 changes: 2 additions & 3 deletions docs/classes/jws_compact_sign.CompactSign.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
The CompactSign class is a utility for creating Compact JWS strings.

**`example`** Usage

```js
const jws = await new jose.CompactSign(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'ES256' })
.sign(privateKey)
Expand Down
5 changes: 2 additions & 3 deletions docs/classes/jws_flattened_sign.FlattenedSign.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
The FlattenedSign class is a utility for creating Flattened JWS objects.

**`example`** Usage

```js
const jws = await new jose.FlattenedSign(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.setProtectedHeader({ alg: 'ES256' })
.sign(privateKey)
Expand Down
5 changes: 2 additions & 3 deletions docs/classes/jws_general_sign.GeneralSign.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
The GeneralSign class is a utility for creating General JWS objects.

**`example`** Usage

```js
const jws = await new jose.GeneralSign(
new TextEncoder().encode(
'It’s a dangerous business, Frodo, going out your door.'
)
new TextEncoder().encode('It’s a dangerous business, Frodo, going out your door.'),
)
.addSignature(ecPrivateKey)
.setProtectedHeader({ alg: 'ES256' })
Expand Down
32 changes: 16 additions & 16 deletions docs/classes/jwt_encrypt.EncryptJWT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The EncryptJWT class is a utility for creating Compact JWE formatted JWT strings.

**`example`** Usage

```js
const jwt = await new jose.EncryptJWT({ 'urn:example:claim': true })
.setProtectedHeader({ alg: 'dir', enc: 'A256GCM' })
Expand Down Expand Up @@ -135,11 +136,11 @@ ___

**setContentEncryptionKey**(`cek`): [`EncryptJWT`](jwt_encrypt.EncryptJWT.md)

Sets a content encryption key to use, by default a random suitable one
is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
Sets a content encryption key to use, by default a random suitable one is generated for the JWE
enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand All @@ -163,7 +164,7 @@ Set "exp" (Expiration Time) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand All @@ -175,12 +176,11 @@ ___

**setInitializationVector**(`iv`): [`EncryptJWT`](jwt_encrypt.EncryptJWT.md)

Sets the JWE Initialization Vector to use for content encryption, by default
a random suitable one is generated for the JWE enc" (Encryption Algorithm)
Header Parameter.
Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.

**`deprecated`** You should not use this method. It is only really intended
for test and vector validation purposes.
**`deprecated`** You should not use this method. It is only really intended for test and vector
validation purposes.

#### Parameters

Expand Down Expand Up @@ -252,10 +252,10 @@ ___

**setKeyManagementParameters**(`parameters`): [`EncryptJWT`](jwt_encrypt.EncryptJWT.md)

Sets the JWE Key Management parameters to be used when encrypting.
Use of this is method is really only needed for ECDH based algorithms
when utilizing the Agreement PartyUInfo or Agreement PartyVInfo parameters.
Other parameters will always be randomly generated when needed and missing.
Sets the JWE Key Management parameters to be used when encrypting. Use of this is method is
really only needed for ECDH based algorithms when utilizing the Agreement PartyUInfo or
Agreement PartyVInfo parameters. Other parameters will always be randomly generated when needed
and missing.

#### Parameters

Expand All @@ -279,7 +279,7 @@ Set "nbf" (Not Before) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand All @@ -297,7 +297,7 @@ Sets the JWE Protected Header on the EncryptJWT object.

| Name | Type | Description |
| :------ | :------ | :------ |
| `protectedHeader` | [`CompactJWEHeaderParameters`](../interfaces/types.CompactJWEHeaderParameters.md) | JWE Protected Header. Must contain an "alg" (JWE Algorithm) and "enc" (JWE Encryption Algorithm) properties. |
| `protectedHeader` | [`CompactJWEHeaderParameters`](../interfaces/types.CompactJWEHeaderParameters.md) | JWE Protected Header. Must contain an "alg" (JWE Algorithm) and "enc" (JWE Encryption Algorithm) properties. |

#### Returns

Expand Down
4 changes: 2 additions & 2 deletions docs/classes/jwt_produce.ProduceJWT.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Set "exp" (Expiration Time) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down Expand Up @@ -134,7 +134,7 @@ Set "nbf" (Not Before) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down
5 changes: 3 additions & 2 deletions docs/classes/jwt_sign.SignJWT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The SignJWT class is a utility for creating Compact JWS formatted JWT strings.

**`example`** Usage

```js
const jwt = await new jose.SignJWT({ 'urn:example:claim': true })
.setProtectedHeader({ alg: 'ES256' })
Expand Down Expand Up @@ -77,7 +78,7 @@ Set "exp" (Expiration Time) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down Expand Up @@ -149,7 +150,7 @@ Set "nbf" (Not Before) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down
8 changes: 5 additions & 3 deletions docs/classes/jwt_unsecured.UnsecuredJWT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs.

**`example`** Encoding

```js
const unsecuredJwt = new jose.UnsecuredJWT({ 'urn:example:claim': true })
.setIssuedAt()
Expand All @@ -17,10 +18,11 @@ console.log(unsecuredJwt)
```

**`example`** Decoding

```js
const payload = jose.UnsecuredJWT.decode(jwt, {
issuer: 'urn:example:issuer',
audience: 'urn:example:audience'
audience: 'urn:example:audience',
})

console.log(payload)
Expand Down Expand Up @@ -117,7 +119,7 @@ Set "exp" (Expiration Time) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "exp" (Expiration Time) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down Expand Up @@ -189,7 +191,7 @@ Set "nbf" (Not Before) Claim.

| Name | Type | Description |
| :------ | :------ | :------ |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |
| `input` | `string` \| `number` | "nbf" (Not Before) Claim value to set on the JWT Claims Set. When number is passed that is used as a value, when string is passed it is resolved to a time span and added to the current timestamp. |

#### Returns

Expand Down
2 changes: 2 additions & 0 deletions docs/classes/util_errors.JOSEAlgNotAllowed.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ A unique error code for the particular error subclass.

`Static` `get` **code**(): ``"ERR_JOSE_ALG_NOT_ALLOWED"``

A unique error code for the particular error subclass.

#### Returns

``"ERR_JOSE_ALG_NOT_ALLOWED"``
3 changes: 1 addition & 2 deletions docs/classes/util_errors.JOSEError.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

A generic Error subclass that all other specific
JOSE Error subclasses inherit from.
A generic Error subclass that all other specific JOSE Error subclasses inherit from.

## Table of contents

Expand Down
2 changes: 2 additions & 0 deletions docs/classes/util_errors.JOSENotSupported.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ A unique error code for the particular error subclass.

`Static` `get` **code**(): ``"ERR_JOSE_NOT_SUPPORTED"``

A unique error code for the particular error subclass.

#### Returns

``"ERR_JOSE_NOT_SUPPORTED"``
2 changes: 2 additions & 0 deletions docs/classes/util_errors.JWEDecryptionFailed.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ ___

`Static` `get` **code**(): ``"ERR_JWE_DECRYPTION_FAILED"``

A unique error code for the particular error subclass.

#### Returns

``"ERR_JWE_DECRYPTION_FAILED"``
Loading

0 comments on commit 8b99555

Please sign in to comment.