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

Question about node:crypto #10

Closed
rwv opened this issue May 10, 2024 · 3 comments · Fixed by #13
Closed

Question about node:crypto #10

rwv opened this issue May 10, 2024 · 3 comments · Fixed by #13

Comments

@rwv
Copy link
Contributor

rwv commented May 10, 2024

README says that this project is mainly for web workers and Cloudflare workers. Why node:crypto is imported in v0.0.5 instead of WebCrypto?

See also https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#methods

@bruceharrison1984
Copy link
Owner

bruceharrison1984 commented May 10, 2024

I wrote this specifically for use on Cloudflare, which aliases node:crypto.

https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/

However, I'm now uncertain if the node:crypto shim provided by Cloudflare is the same implementation as is provided by WebCrypto. I presumed it was, but you raise a good point.

@rwv
Copy link
Contributor Author

rwv commented May 11, 2024

node:crypto will not work in Web Worker in browser environment. Also I don't think that cloudflare alias nods:crypto however crypto is globalThis.crypto which is WebCrypto.

@bruceharrison1984
Copy link
Owner

node:crypto works fine in CF as long as you've enabled node compatibility.

However, it's not necessary due to WebCrypro being available as a global. I'll cut a new version and revert this back to what it was.

rwv added a commit to rwv/bcrypt-edge that referenced this issue May 14, 2024
bruceharrison1984 added a commit that referenced this issue May 14, 2024
Fix #10: Revert "import crypto from node:crypto instead of implicit"
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 a pull request may close this issue.

2 participants