sodium-friends / sodium-javascript

Pure Javascript version of sodium-native
MIT License
92 stars 24 forks source link

`randombytes`: Replace run-time require detection #67

Open arneg opened 1 year ago

arneg commented 1 year ago

Using require() as an expression leads to compile errors in webpack. This issue can be solved by guarding the use of require by the 'correct' run-time check using typeof require.

The issue is easy to reproduce by - for example - using libsodium-javascript from a react project.