Skip to content

Commit d8318c2

Browse files
mscdexFishrock123
authored andcommitted
doc: fix crypto update() signatures
PR-URL: #5500 Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
1 parent 15c5662 commit d8318c2

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

doc/api/crypto.markdown

+24-9
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,15 @@ provided a string is returned; otherwise a [`Buffer`][] is returned;
669669
The `Hmac` object can not be used again after `hmac.digest()` has been
670670
called. Multiple calls to `hmac.digest()` will result in an error being thrown.
671671

672-
### hmac.update(data)
672+
### hmac.update(data[, input_encoding])
673673

674-
Update the `Hmac` content with the given `data`. This can be called
675-
many times with new data as it is streamed.
674+
Updates the `Hmac` content with the given `data`, the encoding of which
675+
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
676+
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
677+
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
678+
`input_encoding` is ignored.
679+
680+
This can be called many times with new data as it is streamed.
676681

677682
## Class: Sign
678683

@@ -733,10 +738,15 @@ returned.
733738
The `Sign` object can not be again used after `sign.sign()` method has been
734739
called. Multiple calls to `sign.sign()` will result in an error being thrown.
735740

736-
### sign.update(data)
741+
### sign.update(data[, input_encoding])
737742

738-
Updates the sign object with the given `data`. This can be called many times
739-
with new data as it is streamed.
743+
Updates the `Sign` content with the given `data`, the encoding of which
744+
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
745+
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
746+
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
747+
`input_encoding` is ignored.
748+
749+
This can be called many times with new data as it is streamed.
740750

741751
## Class: Verify
742752

@@ -780,10 +790,15 @@ console.log(verify.verify(public_key, signature));
780790
// Prints true or false
781791
```
782792

783-
### verifier.update(data)
793+
### verifier.update(data[, input_encoding])
784794

785-
Updates the verifier object with the given `data`. This can be called many
786-
times with new data as it is streamed.
795+
Updates the `Verify` content with the given `data`, the encoding of which
796+
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
797+
`'binary'`. If `encoding` is not provided, and the `data` is a string, an
798+
encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][] then
799+
`input_encoding` is ignored.
800+
801+
This can be called many times with new data as it is streamed.
787802

788803
### verifier.verify(object, signature[, signature_format])
789804

0 commit comments

Comments
 (0)