speakeasyjs/speakeasy

crypto.randomBytes is not a function

salman- opened this issue · 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- 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.