mirror of
https://github.com/status-im/react-native-randombytes.git
synced 2026-08-27 09:01:18 +00:00
31c370426489fa8fc0fc0d29975ce4c8c72af471
react-native-randombytes
Usage
Note: only the asynchronous API is supported, due to the limitations of having to go over the RCTBridge, and there being no secure RNG in JavaScriptCore (Math.random is a bit of a joke in the industry)
var randomBytes = require('react-native-randombytes')
randomBytes(4, (err, bytes) => {
console.log(bytes.toString('hex'))
})
Installation
iOS
-
Drag RNRandomBytes.xcodeproj from node_modules/react-native-randombytes into your XCode project.
-
Click on the project in XCode, go to Build Phases, then Link Binary With Libraries and add
libRNRandomBytes.a
Confused? See an example with screenshots here
Languages
C++
39.8%
Java
25.9%
JavaScript
15.4%
Objective-C
13.7%
CMake
5.2%