-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update & fix nodejs data for Crypto
#24979
base: main
Are you sure you want to change the base?
Conversation
"version_added": "15.0.0", | ||
"notes": "Since v17.4.0, a similar method is available via the <code>crypto</code> module." |
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.
This doesn't look right: Since the parent feature is only available via the crypto
module from 15.0.0, and only outside of the crypto
module from 19.0.0, isn't this note obsolete, and the current support statement (17.4.0
) is correct?
"version_added": "15.0.0", | |
"notes": "Since v17.4.0, a similar method is available via the <code>crypto</code> module." | |
"version_added": "17.4.0" |
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.
the v17.4.0 one means require('crypto').getRandomValues()
, see https://nodejs.org/docs/latest/api/crypto.html#cryptogetrandomvaluestypedarray
the v15.0.0 one means require('crypto').webcrypto.getRandomValues()
, see https://nodejs.org/docs/latest/api/webcrypto.html#cryptogetrandomvaluestypedarray
per documentation, the v17.4.0 one is simply an alias of the v15.0.0 one
also, since here is referring Crypto
interface's getRandomValues()
, the v15.0.0 should be used instead
"notes": "From version 14.17.0, a similar method is available as <a href='https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto'><code>crypto.randomUUID()</code></a>." | ||
} | ||
], | ||
"nodejs": { |
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.
Why don't we keep the "version_added": "19.0.0"
entry?
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.
because there is no difference made to randomUUID()
before v19.0.0 and after v19.0.0 (while the Crypto
interface is exposed to global scope, so just combine the previous two entries)
Co-authored-by: Claas Augner <495429+caugner@users.noreply.github.com>
Summary
The support for the Web Crypto API is:
in v15.0.0, the API has been shipped, but can't access globally, access via the
crypto
module with the alternative namewebcrypto
via nodejs/node#35093in v17.6.0, v16.15.0, the API can be available to global context, but need to be enabled with
--experimental-global-webcrypto
CLI flag via nodejs/node#41938in v19.0.0, the API is available to global context without flags, but can be disabled with
--no-experimental-global-webcrypto
CLI flag via nodejs/node#42083in v23.0.0, the API is marked as not experimental via nodejs/node#52564
See also:
https://nodejs.org/docs/latest/api/globals.html#crypto
https://nodejs.org/docs/latest/api/webcrypto.html#class-crypto
https://nodejs.org/docs/latest/api/crypto.html#cryptorandomuuidoptions
https://nodejs.org/docs/latest/api/crypto.html#cryptogetrandomvaluestypedarray
Also fixes #23784
Also note that the fix in #21414 and the test in #20752 is not correct, as the issue and PR use the link of the
getRandomValues()
method ofcrypto
module (which says v17.4.0), NOT thegetRandomValues()
method of Web Crypto API (which says v15.0.0). Also notice that, thegetRandomValues()
method ofcrypto
module is simply a convenient alias of thegetRandomValues()
method of Web Crypto APITest results and supporting details
Related issues