Skip to content

Commit 02bc99d

Browse files
ZaneHannanAUtargos
authored andcommitted
doc: correct parameters, return types in crypto.md
PR-URL: #21420 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5bb6e5c commit 02bc99d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

doc/api/crypto.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ once will result in an error being thrown.
245245
added: v1.0.0
246246
-->
247247
- `buffer` {Buffer}
248-
- `options` {Object}
248+
- `options` {Object} [`stream.transform` options][]
249+
- `plaintextLength` {number}
249250
- Returns: {Cipher} for method chaining.
250251

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

401-
### decipher.setAAD(buffer)
402+
### decipher.setAAD(buffer[, options])
402403
<!-- YAML
403404
added: v1.0.0
404405
changes:
@@ -407,12 +408,18 @@ changes:
407408
description: This method now returns a reference to `decipher`.
408409
-->
409410
- `buffer` {Buffer | TypedArray | DataView}
410-
- Returns: {Cipher} for method chaining.
411+
- `options` {Object} [`stream.transform` options][]
412+
- `plaintextLength` {number}
413+
- Returns: {Decipher} for method chaining.
411414

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

419+
The `options` argument is optional for `GCM`. When using `CCM`, the
420+
`plaintextLength` option must be specified and its value must match the length
421+
of the plaintext in bytes. See [CCM mode][].
422+
416423
The `decipher.setAAD()` method must be called before [`decipher.update()`][].
417424

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

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

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

0 commit comments

Comments
 (0)