From 68935d7c13b7f5abe7a7665f86ba8fd346303bd7 Mon Sep 17 00:00:00 2001 From: Jonathan Buhacoff Date: Mon, 27 Apr 2020 09:19:30 -0700 Subject: [PATCH 1/3] Update crypto.md to correct description of `decipher.setAuthTag` Calling `decipher.setAuthTag` after `decipher.update` will result in an error like `Unsupported state or unable to authenticate data`. The example code in [CCM mode](https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_ccm_mode) is correct, but to demonstrate the mistake in the documentation you can take the same example and move the `setAuthTag` call to in between `update` and `final` you will see the error. --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index e1c8596abe6a68..88bc541006b0d9 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -521,7 +521,7 @@ is invalid according to [NIST SP 800-38D][] or does not match the value of the `authTagLength` option, `decipher.setAuthTag()` will throw an error. The `decipher.setAuthTag()` method must be called before -[`decipher.final()`][] and can only be called once. +[`decipher.update()`][] and can only be called once. ### `decipher.setAutoPadding([autoPadding])`