Page MenuHomePhabricator

Reimplement generateRandomString using browser crypto module
ClosedPublic

Authored by ashoat on Feb 12 2023, 6:40 PM.
Tags
None
Referenced Files
F2833093: D6697.id22381.diff
Sat, Sep 28, 6:56 AM
Unknown Object (File)
Thu, Sep 26, 7:56 AM
Unknown Object (File)
Tue, Sep 24, 8:42 AM
Unknown Object (File)
Thu, Sep 19, 8:38 AM
Unknown Object (File)
Sat, Sep 14, 10:39 AM
Unknown Object (File)
Sat, Sep 14, 10:39 AM
Unknown Object (File)
Sat, Sep 14, 10:39 AM
Unknown Object (File)
Sat, Sep 14, 10:33 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
No Lint Coverage
Unit
No Test Coverage