Skip to content

Commit 052aec7

Browse files
authored
doc: deprecate CryptoKey use in node:crypto
Refs: #55293 PR-URL: #62321 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 69fdff9 commit 052aec7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

doc/api/deprecations.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4481,6 +4481,42 @@ const server = http2.createSecureServer({
44814481
});
44824482
```
44834483
4484+
### DEP0203: Passing `CryptoKey` to `node:crypto` APIs
4485+
4486+
<!-- YAML
4487+
changes:
4488+
- version: REPLACEME
4489+
pr-url: https://github.com/nodejs/node/pull/62321
4490+
description: Documentation-only deprecation.
4491+
-->
4492+
4493+
Type: Documentation-only
4494+
4495+
Passing a [`CryptoKey`][] to `node:crypto` functions is deprecated and
4496+
will throw an error in a future version. This includes
4497+
[`crypto.createPublicKey()`][], [`crypto.createPrivateKey()`][],
4498+
[`crypto.sign()`][], [`crypto.verify()`][],
4499+
[`crypto.publicEncrypt()`][], [`crypto.publicDecrypt()`][],
4500+
[`crypto.privateEncrypt()`][], [`crypto.privateDecrypt()`][],
4501+
[`Sign.prototype.sign()`][], [`Verify.prototype.verify()`][],
4502+
[`crypto.createHmac()`][], [`crypto.createCipheriv()`][],
4503+
[`crypto.createDecipheriv()`][], [`crypto.encapsulate()`][], and
4504+
[`crypto.decapsulate()`][].
4505+
4506+
### DEP0204: `KeyObject.from()` with non-extractable `CryptoKey`
4507+
4508+
<!-- YAML
4509+
changes:
4510+
- version: REPLACEME
4511+
pr-url: https://github.com/nodejs/node/pull/62321
4512+
description: Documentation-only deprecation.
4513+
-->
4514+
4515+
Type: Documentation-only
4516+
4517+
Passing a non-extractable [`CryptoKey`][] to [`KeyObject.from()`][] is
4518+
deprecated and will throw an error in a future version.
4519+
44844520
[DEP0142]: #dep0142-repl_builtinlibs
44854521
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
44864522
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -4498,14 +4534,18 @@ const server = http2.createSecureServer({
44984534
[`Buffer.from(buffer)`]: buffer.md#static-method-bufferfrombuffer
44994535
[`Buffer.isBuffer()`]: buffer.md#static-method-bufferisbufferobj
45004536
[`Cipheriv`]: crypto.md#class-cipheriv
4537+
[`CryptoKey`]: webcrypto.md#class-cryptokey
45014538
[`Decipheriv`]: crypto.md#class-decipheriv
45024539
[`Duplex.toWeb()`]: stream.md#streamduplextowebstreamduplex-options
45034540
[`Error.isError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/isError
4541+
[`KeyObject.from()`]: crypto.md#static-method-keyobjectfromkey
45044542
[`REPLServer.clearBufferedCommand()`]: repl.md#replserverclearbufferedcommand
45054543
[`ReadStream.open()`]: fs.md#class-fsreadstream
45064544
[`Server.getConnections()`]: net.md#servergetconnectionscallback
45074545
[`Server.listen({fd: <number>})`]: net.md#serverlistenhandle-backlog-callback
4546+
[`Sign.prototype.sign()`]: crypto.md#signsignprivatekey-outputencoding
45084547
[`String.prototype.toWellFormed`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toWellFormed
4548+
[`Verify.prototype.verify()`]: crypto.md#verifyverifyobject-signature-signatureencoding
45094549
[`WriteStream.open()`]: fs.md#class-fswritestream
45104550
[`assert`]: assert.md
45114551
[`asyncResource.runInAsyncScope()`]: async_context.md#asyncresourceruninasyncscopefn-thisarg-args
@@ -4523,11 +4563,21 @@ const server = http2.createSecureServer({
45234563
[`crypto.createDecipheriv()`]: crypto.md#cryptocreatedecipherivalgorithm-key-iv-options
45244564
[`crypto.createHash()`]: crypto.md#cryptocreatehashalgorithm-options
45254565
[`crypto.createHmac()`]: crypto.md#cryptocreatehmacalgorithm-key-options
4566+
[`crypto.createPrivateKey()`]: crypto.md#cryptocreateprivatekeykey
4567+
[`crypto.createPublicKey()`]: crypto.md#cryptocreatepublickeykey
4568+
[`crypto.decapsulate()`]: crypto.md#cryptodecapsulatekey-ciphertext-callback
4569+
[`crypto.encapsulate()`]: crypto.md#cryptoencapsulatekey-callback
45264570
[`crypto.fips`]: crypto.md#cryptofips
45274571
[`crypto.pbkdf2()`]: crypto.md#cryptopbkdf2password-salt-iterations-keylen-digest-callback
4572+
[`crypto.privateDecrypt()`]: crypto.md#cryptoprivatedecryptprivatekey-buffer
4573+
[`crypto.privateEncrypt()`]: crypto.md#cryptoprivateencryptprivatekey-buffer
4574+
[`crypto.publicDecrypt()`]: crypto.md#cryptopublicdecryptkey-buffer
4575+
[`crypto.publicEncrypt()`]: crypto.md#cryptopublicencryptkey-buffer
45284576
[`crypto.randomBytes()`]: crypto.md#cryptorandombytessize-callback
45294577
[`crypto.scrypt()`]: crypto.md#cryptoscryptpassword-salt-keylen-options-callback
45304578
[`crypto.setEngine()`]: crypto.md#cryptosetengineengine-flags
4579+
[`crypto.sign()`]: crypto.md#cryptosignalgorithm-data-key-callback
4580+
[`crypto.verify()`]: crypto.md#cryptoverifyalgorithm-data-key-signature-callback
45314581
[`decipher.final()`]: crypto.md#decipherfinaloutputencoding
45324582
[`decipher.setAuthTag()`]: crypto.md#deciphersetauthtagbuffer-encoding
45334583
[`dirent.parentPath`]: fs.md#direntparentpath

0 commit comments

Comments
 (0)