Skip to content

Commit

Permalink
feat(remix-node): use Web Crypto API in createFileSessionStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Aug 22, 2023
1 parent 5de3187 commit fb5c864
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/remix-node/sessions/fileStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
// This storage manages an id space of 2^64 ids, which is far greater
// than the maximum number of files allowed on an NTFS or ext4 volume
// (2^32). However, the larger id space should help to avoid collisions
Expand Down

0 comments on commit fb5c864

Please sign in to comment.