-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Methods fail with Miniflare and Node.js 18.4+ #446
Comments
Hi @ItalyPaleAle, I don't see a way to support both. If cloudflare supported the Ed25519 identifier, #385 would solve this issue. As of right now, i'd rather support Workers than miniflare. |
cc @jasnell the NODE-ED25519 identifier was removed from Node, the Ed25519 identifier is needed for interoperability between node and workers. |
@panva yes I agree it’s a situation that requires trade-offs. What would you think about accepting both |
Hey! 👋 This is a bug in Miniflare, which should be replicating the Workers environment. I'll try fix this there, and return the "correct" |
The `Ed25519` algorithm was leaking to user code via `CryptoKey#algorithm.name`, but Cloudflare Workers only support the `NODE-ED25519` algorithm. This change plugs the leak, by overriding `algorithm.name`, and then using `Proxy`s before passing `CryptoKey`s back to Node. Closes panva/jose#446.
This was resolved in cloudflare/miniflare@b3e187d |
What happened?
Following the implementation of nodejs/node#43310 (an issue I'm sure you're very familiar with 😄) in 18.4, Node.js dropped support for the
NODE-ED25519
identifier. However, that's still being used in Cloudflare Workers, which doesn't support the newerEd25519
identifier.The
jose
library correctly handles the CF Workers situation.As you are likely familiar with, Miniflare is a "local emulator" for CF Workers, which uses Node.js and not V8.
Starting with Miniflare 2.7, the emulator automatically converts
NODE-ED25519
keys toEd25519
so it continues to work with Node.js 18.4+. cloudflare/miniflare#311However, this causes a situation with jose so it doesn't work with Miniflare on Node.js 18.4+. jose has built-in detection for CF Workers, and it detects Miniflare as a CF Workers environment, and the EdDSA routines reject keys that have type
Ed25519
.jose/src/lib/crypto_key.ts
Lines 74 to 77 in 0096c0a
This causes a runtime error
CryptoKey does not support this operation, its algorithm.name must be NODE-ED25519
Version
v4.9.2
Runtime
Other (I will specify below)
Runtime Details
Miniflare 2.7.1 with Node.js 18.4+
Code to reproduce
Required
The text was updated successfully, but these errors were encountered: