-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(remix-node): use Web Crypto API in createFileSessionStorage
#7203
feat(remix-node): use Web Crypto API in createFileSessionStorage
#7203
Conversation
🦋 Changeset detectedLatest commit: c1c816f The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
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 |
64abd25
to
1d59a29
Compare
@@ -42,7 +42,7 @@ export function createFileSessionStorage<Data = SessionData, FlashData = Data>({ | |||
while (true) { | |||
// TODO: Once node v16 is available on AWS we should use the webcrypto | |||
// API's crypto.getRandomValues() function here instead. | |||
let randomBytes = crypto.randomBytes(8); | |||
let randomBytes = crypto.webcrypto.getRandomValues(new Uint8Array(8)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why Node put Web Crypto API under crypto.webCrypto
instead of globally like in any other runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be under the global crypto
, but only in Node v19
Since the new minimum version is v18, we need to do it like this unfortunately 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's nice to hear, so far I couldn't use WebCrypto in code that's not dependent of the runtime (some remix-auth strategies) because how to access the API depends if it's Node or basically anything else where it's global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comments in our code to point to Node v19 in #7204, so we at least know that we can use the global crypto
once we drop support for Node 18
fb5c864
to
5829d5f
Compare
ca65463
to
b6414fe
Compare
b6414fe
to
18f640d
Compare
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
1 similar comment
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
https://nodejs.org/docs/latest-v20.x/api/crypto.html#cryptogetrandomvaluestypedarray
https://nodejs.org/docs/latest-v20.x/api/crypto.html#cryptowebcrypto
https://nodejs.org/docs/latest-v20.x/api/webcrypto.html#cryptogetrandomvaluestypedarray