Closed ninofiliu closed 5 years ago
Sorry for this late answer, but for people running into this problem: crypto
is a node.js library and not available in the browser. Since there seems to be no way to provide a alternative to crypto
theres no way to use this library in a browser except for removing the import and not use any functions related to generating or verifying keys (which you probably shouldn't do in a browser anyways?).
I was using speakeasy as a server response emulation in my front-end while waiting for the back-end team to implement the rest of the MFA, so I needed speakeasy in the front-end but not for production.
But thanks for the (late) input! This resolves my issue.
Hi Angular users!
As some of you may have encoutered, the line:
throws the error
I resolved it by commenting out, in
path/to/node_modules/speakeasy
:crypto = require('crypto');
(Crypto is already included in recent version of Nodes)exports.generate_key
exports.generate_key_ascii
It now works but I'm worried about the side effects. I think that if I don't use the exports I've commented out (which are, by the way, deprecated) I think that everything is going to be alright but I first wanted to check with more experienced users.