{"library":"react-native-securerandom","title":"Cryptographically Secure Random Bytes for React Native","description":"The `react-native-securerandom` library provides a robust solution for generating cryptographically-secure random bytes within React Native applications. Currently stable at version `1.0.1`, it utilizes native platform APIs such as `SecRandomCopyBytes` on iOS, `SecureRandom` on Android, and `System.Security.Cryptography.RandomNumberGenerator` on Windows to ensure true cryptographic randomness, differentiating it from JavaScript-only PRNGs. Recent updates, including version `1.0.1`, address compatibility with newer React Native versions (e.g., Gradle 7 support for RN 0.68+) and have seen new maintainers join the project, indicating ongoing but generally slower maintenance focused on compatibility and stability rather than rapid feature additions.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install react-native-securerandom"],"cli":null},"imports":["import { generateSecureRandom } from 'react-native-securerandom';","import { generateSecureRandom } from 'react-native-securerandom';\n\nawait generateSecureRandom(16);","import { generateSecureRandom, type SecureRandomError } from 'react-native-securerandom';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { generateSecureRandom } from 'react-native-securerandom';\n\nasync function getRandomBytes(length: number): Promise<Uint8Array> {\n  try {\n    const randomBytes = await generateSecureRandom(length);\n    console.log(`Generated ${length} secure random bytes:`, randomBytes);\n    return randomBytes;\n  } catch (error) {\n    console.error('Failed to generate secure random bytes:', error);\n    throw error;\n  }\n}\n\n// Example usage:\ngetRandomBytes(12).then(bytes => console.log('First batch done.'));\ngetRandomBytes(32).then(bytes => console.log('Second batch done.'));","lang":"typescript","description":"Demonstrates how to import `generateSecureRandom` and asynchronously use it to generate an array of cryptographically secure random bytes, including basic error handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}