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

fix: Use WebCrypto instead of node crypto module #633

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

MPratley
Copy link
Contributor

@MPratley MPratley commented Jan 14, 2025

About this Pull Request

Fixes #632

Removing uuid-random in #631 had the unintended side effect of breaking compatibility with non-node platforms (importing from the 'crypto' module is node specific.)

This change swaps out node's randomUUID implementation with webcrypto's crypto.randomUUID instead. This is supported on all current node versions, cloudflare workers etc.

It should also work in Web Workers, unless on an ancient browser version.

Pull Request Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have added tests to cover my changes
    • (no new tests on account of this being a no-op in node.)
  • All new and existing tests passed
  • My commit messages follow the commit guidelines

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.

crypto import breaks Web Worker compatibility - need alternative UUID solution
2 participants