{"id":16487351,"url":"https://github.com/robhogan/react-native-securerandom","last_synced_at":"2025-04-06T11:10:35.762Z","repository":{"id":38958982,"uuid":"106576511","full_name":"robhogan/react-native-securerandom","owner":"robhogan","description":"A crypto-secure random bytes generator for react native","archived":false,"fork":false,"pushed_at":"2023-07-01T08:16:13.000Z","size":517,"stargazers_count":63,"open_issues_count":5,"forks_count":33,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T10:07:36.654Z","etag":null,"topics":["cryptography","csprng","prng","randomnumbergenerator","react-native","secrandomcopybytes","securerandom"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robhogan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-11T16:00:02.000Z","updated_at":"2024-12-01T05:08:32.000Z","dependencies_parsed_at":"2024-06-18T13:46:00.246Z","dependency_job_id":"b12769a2-fb0b-47dc-97e4-488eb0a08d76","html_url":"https://github.com/robhogan/react-native-securerandom","commit_stats":{"total_commits":46,"total_committers":7,"mean_commits":6.571428571428571,"dds":0.6304347826086957,"last_synced_commit":"d60ec2258a50cab3be509fc89e26c0c1c720aa94"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-securerandom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-securerandom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-securerandom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhogan%2Freact-native-securerandom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robhogan","download_url":"https://codeload.github.com/robhogan/react-native-securerandom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471521,"owners_count":20944158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","csprng","prng","randomnumbergenerator","react-native","secrandomcopybytes","securerandom"],"created_at":"2024-10-11T13:33:51.387Z","updated_at":"2025-04-06T11:10:35.747Z","avatar_url":"https://github.com/robhogan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"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) =\u003e Promise\\\u003cUint8Array\\\u003e\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 =\u003e 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 =\u003e '../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\u003cIReactPackage\u003e` returned by the `Packages` method\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhogan%2Freact-native-securerandom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobhogan%2Freact-native-securerandom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhogan%2Freact-native-securerandom/lists"}