dchest / tweetnacl-js

Port of TweetNaCl cryptographic library to JavaScript
https://tweetnacl.js.org
The Unlicense
1.77k stars 293 forks source link

additional param 'randomBytes' #197

Closed dori871992 closed 4 years ago

dori871992 commented 4 years ago

Add additional param "randomBytes" that will be generated and provided from outside package implementation because package itself does not support pseudo-random number generation (PRNG) for react native platform (only Node js and browsers).

dchest commented 4 years ago

Thanks, but I don’t like this, since I’m sure this will me misused. I commented here on how to integrate React Native’s random byte generator:

the way we worked around the requirement for PRNG to be synchronous in React Native is to initialize synchronous JavaScript-level CSPRNG with a 32-byte seed provided by system's PRNG before using the library.

You can use setPRNG to do it.