no PRNG in react-native #252
Answered
by
dchest
shin101004
asked this question in
Q&A
-
i use nacl in react-native. when i use nacl.box.keyPair(), it returns no PRNG error i read the issue already opened in Issues. i try to use require and import. Is there any reason error occurred? |
Beta Was this translation helpful? Give feedback.
Answered by
dchest
Mar 15, 2023
Replies: 1 comment
-
Yeah, since react-native doesn't have |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dchest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, since react-native doesn't have
crypto.randomBytes
orwindow.getRandomValues
, you need to supply your own synchronous PRNG withnacl.setPRNG
or use a polyfill, for example this module https://www.npmjs.com/package/react-native-get-random-values (note: I haven't verified if it's correctly and securely implemented).