{"_id":"react-native-securerandom","_rev":"4581185","name":"react-native-securerandom","description":"Generate cryptographically-secure random bytes in react native","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"rh389","email":""}],"time":{"modified":"2026-04-10T16:01:18.000Z","created":"2017-10-11T18:38:10.056Z","1.0.1":"2022-09-22T12:11:53.796Z","1.0.0":"2020-05-23T15:32:22.133Z","1.0.0-rc.0":"2019-06-04T13:24:42.743Z","0.3.1":"2019-06-04T12:50:41.912Z","0.3.0":"2018-10-06T18:46:48.687Z","0.2.0":"2018-09-16T15:41:22.208Z","0.1.1":"2017-10-11T18:38:10.056Z"},"users":{},"author":{"name":"Rob Hogan","email":"npm@rhogan.net","url":"https://github.com/robhogan"},"repository":{"type":"git","url":"git+https://github.com/robhogan/react-native-securerandom.git"},"versions":{"1.0.1":{"name":"react-native-securerandom","version":"1.0.1","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"flow && jest"},"types":"index.d.ts","author":{"name":"Rob Hogan","email":"npm@rhogan.net","url":"https://github.com/robhogan"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/robhogan/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/robhogan/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.1.0","babel-jest":"^29.0.3","flow-bin":"^0.187.1","jest":"^29.0.3","react-native":"^0.69.0"},"jest":{"transform":{"^.+\\.js$":"<rootDir>/jest.babel.js"}},"gitHead":"d60ec2258a50cab3be509fc89e26c0c1c720aa94","bugs":{"url":"https://github.com/robhogan/react-native-securerandom/issues"},"_id":"react-native-securerandom@1.0.1","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"shasum":"dc983cce980c80d1af62406e2ef2917ed0ada55f","size":14878,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-1.0.1.tgz"},"_npmUser":{"name":"rh389","email":"rob@rhogan.net"},"directories":{},"maintainers":[{"name":"rh389","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_1.0.1_1663848713657_0.6326817674061487"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-22T12:57:09.746Z","publish_time":1663848713796,"_cnpm_publish_time":1663848713796},"1.0.0":{"name":"react-native-securerandom","version":"1.0.0","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"flow && jest"},"types":"index.d.ts","author":{"name":"Rob Hogan","email":"npm@rhogan.net","url":"https://github.com/rh389"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.1.0","babel-jest":"^24.8.0","flow-bin":"^0.78.0","jest":"^24.8.0","react-native":"^0.57.2"},"jest":{"transform":{"^.+\\.js$":"<rootDir>/jest.babel.js"}},"gitHead":"904321397834dac3a299e7971fa1d50d4cbfa5c3","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@1.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"1cff2f727c90c9ec3318b42dbf825a628b53b49b","size":16176,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-1.0.0.tgz"},"maintainers":[{"name":"rh389","email":""}],"_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_1.0.0_1590247942020_0.5499582524304114"},"_hasShrinkwrap":false,"publish_time":1590247942133,"_cnpm_publish_time":1590247942133,"_cnpmcore_publish_time":"2021-12-16T21:16:57.808Z"},"1.0.0-rc.0":{"name":"react-native-securerandom","version":"1.0.0-rc.0","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"flow && jest"},"author":{"name":"Rob Hogan","email":"npm@rhogan.net","url":"https://github.com/rh389"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.1.0","babel-jest":"^24.8.0","flow-bin":"^0.78.0","jest":"^24.8.0","react-native":"^0.57.2"},"jest":{"transform":{"^.+\\.js$":"<rootDir>/jest.babel.js"}},"gitHead":"7b512c84d5291e95f6775870fdb25b7229b80b0d","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@1.0.0-rc.0","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"dist":{"shasum":"fbbf682dd59fd1651f65e689c9f4fe1a911503f5","size":16116,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-1.0.0-rc.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-1.0.0-rc.0.tgz"},"maintainers":[{"name":"rh389","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_1.0.0-rc.0_1559654682588_0.26946984291498377"},"_hasShrinkwrap":false,"publish_time":1559654682743,"_cnpm_publish_time":1559654682743,"_cnpmcore_publish_time":"2021-12-16T21:16:58.067Z"},"0.3.1":{"name":"react-native-securerandom","version":"0.3.1","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"flow && jest"},"author":{"name":"Rob Hogan","email":"npm@rhogan.net"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.1.0","babel-jest":"^24.8.0","flow-bin":"^0.78.0","jest":"^24.8.0","react-native":"^0.57.2"},"jest":{"transform":{"^.+\\.js$":"<rootDir>/jest.babel.js"}},"gitHead":"de9ea10e2aef74c8206b129655d94c99b2f2d1b6","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@0.3.1","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"dist":{"shasum":"dc4d5e5cf624e30877996fe3f1a249d6b43c4a50","size":15085,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-0.3.1.tgz"},"maintainers":[{"name":"rh389","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_0.3.1_1559652641822_0.4079564598029606"},"_hasShrinkwrap":false,"publish_time":1559652641912,"_cnpm_publish_time":1559652641912,"_cnpmcore_publish_time":"2021-12-16T21:16:58.277Z"},"0.3.0":{"name":"react-native-securerandom","version":"0.3.0","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"flow && jest"},"author":{"name":"Rob Hogan","email":"roberthogan@blueyonder.co.uk"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"devDependencies":{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","babel-core":"^7.0.0-bridge.0","babel-jest":"^23.6.0","flow-bin":"^0.78.0","jest":"^23.6.0","react-native":"^0.57.2"},"gitHead":"a8b6170397551678ed9fa764f61dc8fb436a44b7","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@0.3.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"dist":{"shasum":"4b85c39eb1babc8cd662c7174d96eb149486fae1","size":11704,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-0.3.0.tgz"},"maintainers":[{"name":"rh389","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_0.3.0_1538851608527_0.6222887556188628"},"_hasShrinkwrap":false,"publish_time":1538851608687,"_cnpm_publish_time":1538851608687,"_cnpmcore_publish_time":"2021-12-16T21:16:58.639Z"},"0.2.0":{"name":"react-native-securerandom","version":"0.2.0","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Rob Hogan","email":"roberthogan@blueyonder.co.uk"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto","RandomNumberGenerator","Cryptography"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"gitHead":"863f21b22a34fe568a64f9e02779057862aeff4d","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@0.2.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"dist":{"shasum":"8df331c3db954d7a02f7152f688a1bf43912e554","size":10198,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-0.2.0.tgz"},"maintainers":[{"name":"rh389","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom_0.2.0_1537112482018_0.18683553166838185"},"_hasShrinkwrap":false,"publish_time":1537112482208,"_cnpm_publish_time":1537112482208,"_cnpmcore_publish_time":"2021-12-16T21:16:58.848Z"},"0.1.1":{"name":"react-native-securerandom","version":"0.1.1","description":"Generate cryptographically-secure random bytes in react native","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Rob Hogan","email":"roberthogan@blueyonder.co.uk"},"license":"MIT","peerDependencies":{"react-native":"*"},"repository":{"type":"git","url":"git+https://github.com/rh389/react-native-securerandom.git"},"keywords":["react-native","SecRandomCopyBytes","PRNG","CSPRNG","SecureRandom","crypto"],"homepage":"https://github.com/rh389/react-native-securerandom#readme","dependencies":{"base64-js":"*"},"gitHead":"836381f1feb812a373169bd2d3dbeb9356a51aa8","bugs":{"url":"https://github.com/rh389/react-native-securerandom/issues"},"_id":"react-native-securerandom@0.1.1","_shasum":"f130623a412c338b0afadedbc204c5cbb8bf2070","_from":".","_npmVersion":"2.15.12","_nodeVersion":"6.3.1","_npmUser":{"name":"rh389","email":"roberthogan@blueyonder.co.uk"},"dist":{"shasum":"f130623a412c338b0afadedbc204c5cbb8bf2070","size":1610994,"noattachment":false,"key":"/react-native-securerandom/-/react-native-securerandom-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-native-securerandom/download/react-native-securerandom-0.1.1.tgz"},"maintainers":[{"name":"rh389","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-securerandom-0.1.1.tgz_1507747087920_0.9047892719972879"},"directories":{},"publish_time":1507747090056,"_hasShrinkwrap":false,"_cnpm_publish_time":1507747090056,"_cnpmcore_publish_time":"2021-12-16T21:17:01.867Z"}},"readme":"# react-native-securerandom\n[![npm version](https://badge.fury.io/js/react-native-securerandom.svg)](https://badge.fury.io/js/react-native-securerandom)\n\nA library to generate cryptographically-secure random bytes. Uses `SecRandomCopyBytes` on iOS, `SecureRandom` on Android and `System.Security.Cryptography.RandomNumberGenerator` on Windows.\n\n## Usage\nThe library exports a single function:\n### generateSecureRandom(length: number) => Promise\\<Uint8Array\\>\nTakes a length, the number of bytes to generate, and returns a `Promise` that resolves with a `Uint8Array`.\n\n```javascript\nimport { generateSecureRandom } from 'react-native-securerandom';\n\ngenerateSecureRandom(12).then(randomBytes => console.log(randomBytes));\n```\n\n## Installation\n\n`$ yarn add react-native-securerandom`\n\n### Automatic linking with react-native link\n\n`$ react-native link react-native-securerandom`\n\n### Manual linking\n\n#### iOS\n\n##### With Cocoapods\n1. Add `pod 'RNSecureRandom', :path => '../node_modules/react-native-securerandom'` to your `Podfile` (changing your `node_modules` path as appropriate)\n2. Run `pod install` from the same directory as your `Podfile`\n\n##### Without Cocoapods\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-securerandom` and add `RNSecureRandom.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNSecureRandom.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import net.rhogan.rnsecurerandom.RNSecureRandomPackage;` to the imports at the top of the file\n  - Add `new RNSecureRandomPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-securerandom'\n  \tproject(':react-native-securerandom').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-securerandom/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      compile project(':react-native-securerandom')\n  \t```\n\n#### Windows\n\nSee [react-native-windows](https://github.com/Microsoft/react-native-windows)\n\n1. In Visual Studio add `node_modules/react-native-securerandom/windows/RNSecureRandom.sln` folder to your solution, and reference from your app.\n2. Open up your app's `MainPage.cs`\n  - Add `using Net.Rhogan.RNSecureRandom.RNSecureRandom;` to the usings at the top of the file\n  - Add `new RNSecureRandomPackage()` to the `List<IReactPackage>` returned by the `Packages` method\n","_attachments":{},"homepage":"https://github.com/robhogan/react-native-securerandom#readme","bugs":{"url":"https://github.com/robhogan/react-native-securerandom/issues"},"license":"MIT"}