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)
Mon, Nov 11, 4:44 AM
Unknown Object (File)
Mon, Nov 11, 4:42 AM
Unknown Object (File)
Sat, Nov 9, 4:55 PM
Unknown Object (File)
Sat, Oct 26, 6:55 PM
Unknown Object (File)
Sat, Oct 26, 6:55 PM
Unknown Object (File)
Oct 16 2024, 9:48 AM
Unknown Object (File)
Oct 13 2024, 7:03 AM
Unknown Object (File)
Sep 28 2024, 6:56 AM
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