Page MenuHomePhabricator

Reimplement generateRandomString using browser crypto module
ClosedPublic

Authored by ashoat on Feb 12 2023, 6:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 28, 3:15 PM
Unknown Object (File)
Mar 2 2025, 8:01 PM
Unknown Object (File)
Mar 2 2025, 8:01 PM
Unknown Object (File)
Mar 2 2025, 8:00 PM
Unknown Object (File)
Mar 2 2025, 7:40 PM
Unknown Object (File)
Feb 25 2025, 3:49 AM
Unknown Object (File)
Feb 21 2025, 2:42 PM
Unknown Object (File)
Feb 21 2025, 2:42 PM
Subscribers
None

Details

Summary

generateRandomString is currently implemented using a polyfill of the Node.js crypto library, but Webpack 5 no longer includes this polyfill by default.

We could configure the polyfill manually, but instead I figured we could save some bundle size and just reimplement this using the browser-native crypto module, which has a getRandomValues function.

Test Plan

console.log'd the results of calling generateDeviceID in web

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable