Skip to content

lib: enable global WebCrypto by default#42083

Merged
aduh95 merged 2 commits intonodejs:mainfrom
aduh95:global-webcrypto-everything
Sep 17, 2022
Merged

lib: enable global WebCrypto by default#42083
aduh95 merged 2 commits intonodejs:mainfrom
aduh95:global-webcrypto-everything

Conversation

@aduh95
Copy link
Copy Markdown
Contributor

@aduh95 aduh95 commented Feb 22, 2022

Enables --experimental-global-webcrypto by default, and ensures that the classic node:crypto core module is still available in --eval or --print contexts.

Currently this PR takes the route of breaking how the REPL can access the node:crypto module – currently the global crypto in REPL refers to node:crypto, with this PR it now refers to the Web Crypto API.
This PR takes the route of keeping node:crypto available when evaluating a string from a CLI flag (e.g. node -p 'crypto.randomBytes(16).toString("hex")') to avoid breaking the ecosystem (see #41779 (comment)).

IMO it makes sense to keep the REPL global crypto same as when parsing files, but I don't have a strong opinion and it's easy to change if the consensus disagrees with me.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. needs-citgm PRs that need a CITGM CI run. review wanted PRs that need reviews. semver-major PRs that contain breaking changes and should be released in the next major version. webcrypto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants