react-native-get-random-values
A small implementation of `crypto.getRandomValues` for React Native. This is useful to polyfill for libraries like [uuid](https://www.npmjs.com/package/uuid) that depend on it.
This package has a good security score with no known vulnerabilities.
Community Reviews
Dead simple polyfill that just works - essential for RN crypto needs
The main use case is enabling uuid and other crypto-dependent libraries in React Native. I've used it across multiple production apps and never had a single issue. The error messages are actually helpful too - if you forget to import it before using uuid, you get a clear 'crypto.getRandomValues() not supported' error that immediately tells you what's wrong.
The documentation is minimal but that's actually a strength here. The README shows the exact two lines you need (import at the top of index.js, then use your crypto libraries), includes troubleshooting for common import order mistakes, and links to the uuid package docs. Community support is solid on GitHub with maintainers responding to issues, though honestly there aren't many issues because it's so straightforward.
Best for: React Native projects needing to use uuid or any library depending on crypto.getRandomValues.
Avoid if: You're working with standard React web apps where crypto.getRandomValues exists natively.
Dead simple polyfill that just works - import once and forget
The documentation is minimal but that's actually appropriate here - there's nothing to configure. The README clearly shows the import order matters (must be before uuid or similar libraries), which is the only real gotcha. Error messages are straightforward when you mess up the import order, making it easy to debug.
Community support isn't really needed because there's so little that can go wrong. The GitHub issues are mostly clarification questions that get answered, though response times vary. The package is stable enough that you rarely need to check for updates. It's one of those dependencies you add once and completely forget about until you set up a new project.
Best for: React Native projects needing to use uuid or other libraries that depend on crypto.getRandomValues.
Avoid if: You're not using React Native or your target libraries already handle missing crypto APIs gracefully.
Simple polyfill that just works, but requires manual import setup
The main operational consideration is remembering to import it before any library that depends on crypto APIs - typically at the very top of your index.js. Miss this and you'll get cryptic runtime errors from uuid or similar packages. There's no retry logic or error handling to speak of, but that's appropriate for this type of polyfill - if native RNG fails, your app has bigger problems.
No logging hooks or observability concerns here - it simply mutates the global crypto object and steps aside. Zero configuration needed, zero breaking changes in typical usage. The v2.0 upgrade was painless in our production apps. Resource usage is trivial and it has no impact on bundle size or startup time.
Best for: React Native apps that need uuid or other crypto-dependent libraries to work without ejecting to native code.
Avoid if: You're building for web only or already have a comprehensive crypto polyfill solution in place.
Sign in to write a review
Sign In