-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: runtime deprecate calling Cipheriv(...)
and Decipheriv(...)
without new
#57268
base: main
Are you sure you want to change the base?
lib: runtime deprecate calling Cipheriv(...)
and Decipheriv(...)
without new
#57268
Conversation
Cipher was removed from the public API a while ago but we were still defining it and exporting `require('crypto').Cipher` as `undefined`. Silly us.
Review requested:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #57268 +/- ##
==========================================
- Coverage 90.24% 90.24% -0.01%
==========================================
Files 630 630
Lines 184908 184883 -25
Branches 36181 36175 -6
==========================================
- Hits 166874 166848 -26
+ Misses 11061 11055 -6
- Partials 6973 6980 +7
|
### DEP0190: Instantiating `node:crypto` `Cipheriv` and `Decipheriv` classes without `new` | ||
|
||
<!-- YAML | ||
changes: | ||
- version: REPLACEME | ||
pr-url: https://github.com/nodejs/node/pull/57268 | ||
description: Runtime deprecation. | ||
--> | ||
|
||
Type: Runtime | ||
|
||
Instantiating the [`Cipheriv`][] and [`Decipheriv`][] classes exported by the `node:crypto` | ||
module is deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do a first PR that doc-deprecates it, so that can be backported to existing release lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been unable to find any examples anywhere of anyone actually calling these (at least in any open source code). I'm not sure there's an actual value in backporting a doc-only deprecation to older lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It simplifies backporting of other deprecations, as it's otherwise likely we would get conflicts. I'm happy to open the doc-only PR myself if you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
The first commit here is from #57266 which is expected to land first. This PR is about the second commit... deprecating calling
Cipheriv(...)
andDecipheriv(...)
without thenew
keyword. Technically we should probably also deprecate creating these directly even with thenew
keyword since we tell people to usecreateCipheriv(...)
andcreateDecipheriv(...)
to create these (both of which simply defer to callingnew ...
but still).I did do a github code search trying to find any examples of folks calling these directly without the new keyword and there were zero hits suggesting that going straight to a runtime deprecation is quite safe.
/cc @nodejs/tsc