speakeasy icon indicating copy to clipboard operation
speakeasy copied to clipboard

crypto.randomBytes is not a function

Open salman- opened this issue 8 years ago • 1 comments

I am trying to use speakeasy, in my Angualr4, and Typescript. In line let secret = speakeasy.generateSecret({length: 20}); it complains with the error: crypto.randomBytes is not a function

How can i fix it?

Described question in Stackoverflow

salman- avatar Oct 12 '17 10:10 salman-

@salman- the link to SO doesn't work. Did you solve this, or is it still a problem? Are you trying to run this in a browser?

The Web Crypto API has a method getRandomValues(), while NodeJS uses randomBytes().

I've just started playing around with speakeasy and it looks like it doesn't support running in the browser yet.

conorgil avatar Oct 12 '17 20:10 conorgil