From 4cf5fc254e543a793f08aaf3b281bfc637610dd7 Mon Sep 17 00:00:00 2001 From: Allon Mureinik Date: Mon, 12 May 2025 22:01:03 +0300 Subject: [PATCH] doc: mark the callback argument of crypto.generatePrime as mandatory The current documentation lists the `callback` argument of `crypto.generatePrime` as optional (it's surrounded by square brackets), but this is incorrect - calling the function without a callback will result in an `ERR_INVALID_ARG_TYPE` error: For the record, the correct way to generate a prime synchronously, without a callback, is to use the `generatePrimeSync` API. This patch fixes the documentation and marks the callback argument as mandatory. The `options` (second) argument, is indeed optional, and is marked as such. Fixes: https://github.com/nodejs/node/issues/58298 --- 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 7761b4fdcc6555..1b5ca23f8050c1 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3900,7 +3900,7 @@ console.log(key.export().toString('hex')); // e89..........41e The size of a generated HMAC key should not exceed the block size of the underlying hash function. See [`crypto.createHmac()`][] for more information. -### `crypto.generatePrime(size[, options[, callback]])` +### `crypto.generatePrime(size[, options], callback)`