electron/node

crypto.generateKeyPair* support in electron node

Opened this issue · 4 comments

I recently updated my project to the latest electron beta (5.0.0-beta.1) which uses node "12" (electron-node-canary) as I was hoping to make use of crypto.generateKeyPairSync that was introduced in node v10.12. Unfortunately, when I call the function, I get the following error TypeError: crypto.generateKeyPairSync is not a function, despite the fact that it works on node latest and lts/dubnium

I've noticed that in the canary branch that feature had been reverted (see commit: c9f4c6f). What was the reason for removing this feature from the latest node build, and is there a chance of bringing it back in?

@Kaimaerah That particular API depends on APIs inside OpenSSL that do not exist inside BoringSSL. It would be possible to rewrite that API to use BoringSSL APIs but it is a not-trivial amount of work.

@MarshallOfSound @codebytere do you want me to look into this?

I would like to see this too please :) if I run Node on its own I can use generateKeyPair but not within electron. Is there a way to call the Node crypto module from Electron?

@ryzokuken that would be 💯

@aykay76 we bundle the entirety of Node.js in Electron, you can run the module it's just that we tweak it to build with BoringSSL instead of OpenSSL for compatibility with Chromium. So the path forward here is to modify our fork to allow it to accomplish what you seek.