Skip to content
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

Don't call getCryptoModule in getSubtle #1340

Merged
merged 1 commit into from
Dec 7, 2022
Merged

Conversation

webmaster128
Copy link
Member

No description provided.

@webmaster128
Copy link
Member Author

@mvid this is step 1 from #1307 (comment)

@webmaster128 webmaster128 marked this pull request as ready for review December 7, 2022 19:27
@webmaster128 webmaster128 added this to the 0.29.x milestone Dec 7, 2022
@webmaster128 webmaster128 merged commit 3560cd4 into main Dec 7, 2022
@webmaster128 webmaster128 deleted the crypro-imports branch December 7, 2022 19:55
@webmaster128
Copy link
Member Author

Released as part of 0.29.5

Comment on lines +27 to +37
// From Node.js 15 onwards, webcrypto is available in globalThis.
// In version 15 and 16 this was stored under the webcrypto key.
// With Node.js 17 it was moved to the same locations where browsers
// make it available.
// Loading `require("crypto")` here seems unnecessary since it only
// causes issues with bundlers and does not increase compatibility.

// Browsers and Node.js 17+
let subtle: any | undefined = (globalThis as any)?.crypto?.subtle;
// Node.js 15+
if (!subtle) subtle = (globalThis as any)?.crypto?.webcrypto?.subtle;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All those comments are wrong because they only apply to the Node.js REPL, not Node.js itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant