Skip to content

Commit

Permalink
doc: correct parameters, return types in crypto.md
Browse files Browse the repository at this point in the history
PR-URL: #21420
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ZaneHannanAU authored and targos committed Jun 24, 2018
1 parent 5bb6e5c commit 02bc99d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ once will result in an error being thrown.
added: v1.0.0
-->
- `buffer` {Buffer}
- `options` {Object}
- `options` {Object} [`stream.transform` options][]
- `plaintextLength` {number}
- Returns: {Cipher} for method chaining.

When using an authenticated encryption mode (only `GCM` and `CCM` are currently
Expand Down Expand Up @@ -398,7 +399,7 @@ Once the `decipher.final()` method has been called, the `Decipher` object can
no longer be used to decrypt data. Attempts to call `decipher.final()` more
than once will result in an error being thrown.

### decipher.setAAD(buffer)
### decipher.setAAD(buffer[, options])
<!-- YAML
added: v1.0.0
changes:
Expand All @@ -407,12 +408,18 @@ changes:
description: This method now returns a reference to `decipher`.
-->
- `buffer` {Buffer | TypedArray | DataView}
- Returns: {Cipher} for method chaining.
- `options` {Object} [`stream.transform` options][]
- `plaintextLength` {number}
- Returns: {Decipher} for method chaining.

When using an authenticated encryption mode (only `GCM` and `CCM` are currently
supported), the `decipher.setAAD()` method sets the value used for the
_additional authenticated data_ (AAD) input parameter.

The `options` argument is optional for `GCM`. When using `CCM`, the
`plaintextLength` option must be specified and its value must match the length
of the plaintext in bytes. See [CCM mode][].

The `decipher.setAAD()` method must be called before [`decipher.update()`][].

### decipher.setAuthTag(buffer)
Expand All @@ -424,7 +431,7 @@ changes:
description: This method now returns a reference to `decipher`.
-->
- `buffer` {Buffer | TypedArray | DataView}
- Returns: {Cipher} for method chaining.
- Returns: {Decipher} for method chaining.

When using an authenticated encryption mode (only `GCM` and `CCM` are currently
supported), the `decipher.setAuthTag()` method is used to pass in the
Expand All @@ -448,7 +455,7 @@ The `decipher.setAuthTag()` method must be called before
added: v0.7.1
-->
- `autoPadding` {boolean} **Default:** `true`
- Returns: {Cipher} for method chaining.
- Returns: {Decipher} for method chaining.

When data has been encrypted without standard block padding, calling
`decipher.setAutoPadding(false)` will disable automatic padding to prevent
Expand Down

0 comments on commit 02bc99d

Please sign in to comment.