Closed ianmcgregor closed 6 years ago
@ianmcgregor this module works out of the box if you have things set up with rn-nodeify. That said, rn-nodeify is missing from this README! I guess I assumed people would be installing this module as part of https://github.com/tradle/react-native-crypto , which explains what to do
Thanks @mvayngrib -- I only need the RNG so this is great now I've got it working. Could also add this example for usage outside of rn-nodify? I can submit a PR if that helps?
@ianmcgregor i like your first suggestion, of having it work out of the box async. Maybe the code should allow require('sjcl') to fail. On failure, console.warn and on sync invocation throw an Error, but keep async working. Either way an explanation in the readme would be good to have. Happy to accept a PR for either the refactor, the readme or both :)
@mvayngrib Allowing the require('sjcl') to fail is looking difficult without adding undesirable complexity to your code due to the way React Native's 'Haste' module system works.
I think your recent update to the README makes it clear how to use for standalone random. Thanks for sharing this code.
I was able to get this working by bypassing
require('react-native-randombytes')
:Should the synchronous sjcl based method be removed entirely so that this module works out of the box?