From 5d68eb44bab33fd693a2ed012fe0086097475cc8 Mon Sep 17 00:00:00 2001 From: Harjoth Khara Date: Wed, 15 Jul 2026 01:41:50 -0700 Subject: [PATCH 1/2] doc: clarify PEM format for signing keys Signed-off-by: harjoth PR-URL: https://github.com/nodejs/node/pull/64404 Fixes: https://github.com/nodejs/node/issues/35331 Reviewed-By: Tim Perry Reviewed-By: Luigi Pinca --- doc/api/crypto.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index b73093c648a90d..3bb09483573279 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2665,8 +2665,10 @@ Calculates the signature on all the data passed through using either [`sign.update()`][] or [`sign.write()`][stream-writable-write]. If `privateKey` is not a [`KeyObject`][], this function behaves as if -`privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an -object, the following additional properties can be passed: +`privateKey` had been passed to [`crypto.createPrivateKey()`][]. When +`privateKey` is a string, `ArrayBuffer`, [`Buffer`][], `TypedArray`, or +`DataView`, it must contain PEM-encoded key material. If it is an object, the +following additional properties can be passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: @@ -2799,8 +2801,10 @@ changes: Verifies the provided data using the given `key` and `signature`. If `key` is not a [`KeyObject`][], this function behaves as if -`key` had been passed to [`crypto.createPublicKey()`][]. If it is an -object, the following additional properties can be passed: +`key` had been passed to [`crypto.createPublicKey()`][]. When `key` is a string, +`ArrayBuffer`, [`Buffer`][], `TypedArray`, or `DataView`, it must contain +PEM-encoded key material. If it is an object, the following additional +properties can be passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: @@ -6209,8 +6213,10 @@ dependent upon the key type. ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been -passed to [`crypto.createPrivateKey()`][]. If it is an object, the following -additional properties can be passed: +passed to [`crypto.createPrivateKey()`][]. When `key` is a string, `ArrayBuffer`, +[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key +material. If it is an object, the following additional properties can be +passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: @@ -6349,8 +6355,10 @@ key type. ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been -passed to [`crypto.createPublicKey()`][]. If it is an object, the following -additional properties can be passed: +passed to [`crypto.createPublicKey()`][]. When `key` is a string, `ArrayBuffer`, +[`Buffer`][], `TypedArray`, or `DataView`, it must contain PEM-encoded key +material. If it is an object, the following additional properties can be +passed: * `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: From bf5c2217045fe2e8150c3c9d7d3f311ae60f1eed Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 15 Jul 2026 10:42:05 +0200 Subject: [PATCH 2/2] stream: simplify nested `PromisePrototypeThen`s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/64470 Reviewed-By: René Reviewed-By: Trivikram Kamat --- lib/internal/webstreams/adapters.js | 48 ++++++++++------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/lib/internal/webstreams/adapters.js b/lib/internal/webstreams/adapters.js index 1ade5d32951ff5..d3f8212f1a135b 100644 --- a/lib/internal/webstreams/adapters.js +++ b/lib/internal/webstreams/adapters.js @@ -335,15 +335,12 @@ function newStreamWritableFromWritableStream(writableStream, options = kEmptyObj } PromisePrototypeThen( - writer.ready, - () => { - return PromisePrototypeThen( - SafePromiseAllReturnVoid( - chunks, - (data) => writer.write(data.chunk)), - done, - done); - }, + PromisePrototypeThen( + writer.ready, + () => SafePromiseAllReturnVoid( + chunks, + (data) => writer.write(data.chunk))), + done, done); }, @@ -372,13 +369,8 @@ function newStreamWritableFromWritableStream(writableStream, options = kEmptyObj } PromisePrototypeThen( - writer.ready, - () => { - return PromisePrototypeThen( - writer.write(chunk), - done, - done); - }, + PromisePrototypeThen(writer.ready, () => writer.write(chunk)), + done, done); }, @@ -801,15 +793,12 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = } PromisePrototypeThen( - writer.ready, - () => { - return PromisePrototypeThen( - SafePromiseAllReturnVoid( - chunks, - (data) => writer.write(data.chunk)), - done, - done); - }, + PromisePrototypeThen( + writer.ready, + () => SafePromiseAllReturnVoid( + chunks, + (data) => writer.write(data.chunk))), + done, done); }, @@ -838,13 +827,8 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = } PromisePrototypeThen( - writer.ready, - () => { - return PromisePrototypeThen( - writer.write(chunk), - done, - done); - }, + PromisePrototypeThen(writer.ready, () => writer.write(chunk)), + done, done); },