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

use node's webcrypto when available #326

Merged
merged 4 commits into from
May 9, 2023
Merged

use node's webcrypto when available #326

merged 4 commits into from
May 9, 2023

Conversation

panva
Copy link
Contributor

@panva panva commented May 4, 2023

This change makes it so that if the node process has a webcrypto API implementation that this implementation be used instead of @peculiar/webcrypto so that Ed25519 and X25519 algorithms become available.

It also patches out the use of Ed448 and X448 Algorithms which are not present in Edge Functions at Vercel. Ed25519 and X25519 already is (or should be?) since it's already present in workerd and CF Workers. This prototype update can easily be omitted but then EdgeRuntime would support more than the Edge Functions at Vercel runtime... This way they're aligned, but it's ugly and messes with the prototype when using edge runtime programatically... I'm happy to remove it from the PR

The @peculiar/webcrypto dependency can be safely dropped when node 14 support is removed.

@vercel
Copy link

vercel bot commented May 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
edge-runtime ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2023 4:54pm

@changeset-bot
Copy link

changeset-bot bot commented May 4, 2023

🦋 Changeset detected

Latest commit: 57694eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@edge-runtime/primitives Minor
@edge-runtime/types Patch
@edge-runtime/vm Patch
@edge-runtime/jest-environment Patch
edge-runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Schniz
Copy link
Collaborator

Schniz commented May 4, 2023

Hey! Thanks for this. I’m going to merge this into main or into #327 on Sunday. We’re changing how stuff works and the fact we can use crypto from node now is amazing. I’m running every version against the Next.js test suite so it’ll take some time to land but hopefully soon! 🙏

(btw @balazsorban44 will open a PR to drop Node14 support afaik)

Copy link
Collaborator

@Schniz Schniz left a comment

Choose a reason for hiding this comment

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

:aww: looks good to me
I'm gonna apply these changes into #327 after merging

@Schniz Schniz merged commit a373606 into vercel:main May 9, 2023
@github-actions github-actions bot mentioned this pull request May 9, 2023
@github-actions github-actions bot mentioned this pull request May 29, 2023
jridgewell pushed a commit to jridgewell/edge-runtime that referenced this pull request Jun 23, 2023
@twiss twiss mentioned this pull request Feb 19, 2024
8 tasks
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.

2 participants