-
Notifications
You must be signed in to change notification settings - Fork 332
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
[Feature] Implement crypto.createCipheriv #3277
Comments
Was can likely prioritize more of the |
Hi there! Do you know if there's any workaround in the meantime? Thanks! |
The only workaround is to use web crypto. |
The code is the Nextjs lib, not in user code so changing to use webcrypto is not trivial. |
Small addition to the original post: in the issue opennextjs/opennextjs-cloudflare#206 using the package next-auth, the problem can (also?) happen from a call to |
I'm pretty sure I tested it with Next 15, any chance you are using a different version than the one of the original bug report? Anyway we should still implement the algo. Thanks for your message. |
Oh sorry I was very zoned into thinking about my specific case while writing that out the first time, and I'm definitely not sure now that spot of code is the only relevant one, especially considering different versions and configurations. I've added a reproduction case on that original issue thread now. |
I created this Repo, This approach addresses the crypto.createCipheriv limitation by substituting Node.js's crypto module with the Web Crypto API Check it out, might be of help |
Thanks @arnavgupta00! If I understand correctly, the main point is to override the encode/decode methods here: |
Yes, that's correct, I've overridden the default |
Thanks @arnavgupta00, do you know if this would work the same with Next15? (I'm planning to add some docs until the workerd implementation is ready) |
Yes, based on the Next.js 15 release documentation, the integration should function similarly. Ensure your {
"compilerOptions": {
"module": "esnext",
"target": "es2017"
}
} This configuration enables top-level |
Thanks! This line looks fishy as |
crypto.createCipheriv
is required by Next Auth.See opennextjs/opennextjs-cloudflare#206
Can we prioritize the implementation of the API?
@jasnell
The crypto APIs are used by Next from
crypto-utils.ts
What is used by Next is:
// * Ciphers
// * [x] crypto.createCipheriv(algorithm, key, iv[, options])
// * [x] crypto.createDecipheriv(algorithm, key, iv[, options])
with the
aes-256-gcm
algoThe text was updated successfully, but these errors were encountered: