-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'randomBytes' of undefined #35
Comments
This is when pbkdf2 native is invoked on electron rebuilded bcrypto:
|
@mpetrunic Have you seen this issue? #27 At runtime, Lines 9 to 16 in 1d257bb
There is also |
Well code never reaches catch clause. It successfully requires native module and fails to execute function there. /node/pbkdf2 works perfectly so that means it would work if native throws exception, |
@tynes Would you be willing to accept PR where all native modules have instead of const assert = require('bsert');
const binding = require('./binding').random; this const assert = require('bsert');
const binding = require('./binding').random;
assert(binding); ? |
Is there any update on this? I also get the same error during jest as @mpetrunic described. Thanks |
Bug is releated to jest and how it handles require calls. Aparently if require trows, jest will same empty object to modules cache and return it on all subsequent calls. Havent found solution yet |
@alexbarnsley @mpetrunic Have you tried the latest version of bcrypto? A lot has changed including the removal of OpenSSL as a dependency. |
OpenSSL is still used, however is via the existing Node.js |
Bcrypto panics when rebuilded by electron.
From my investigation it seems that electron replaces openssl with boressl and this causes some incompatibilities. It seems that requiring of native random passes and doesn't fallback to node version.
I've mitigated it with (ELECTRON env is set by user , not electron itself):
bcrypto 4.2.8
The text was updated successfully, but these errors were encountered: