Gathering detailed insights and metrics for @react-native-module/randombytes
Gathering detailed insights and metrics for @react-native-module/randombytes
npm install @react-native-module/randombytes
Typescript
Module System
Node Version
NPM Version
37.1
Supply Chain
52.5
Quality
66.6
Maintenance
50
Vulnerability
93.8
License
Java (39.96%)
C++ (15.74%)
C# (9.81%)
Objective-C++ (8.16%)
JavaScript (7.27%)
TypeScript (6.86%)
Objective-C (4.36%)
Ruby (4.06%)
Makefile (3.41%)
C (0.23%)
Swift (0.14%)
Total Downloads
4,764
Last Day
2
Last Week
25
Last Month
82
Last Year
1,271
141 Commits
2 Branches
Minified
Minified + Gzipped
Latest Version
4.0.0
Package Id
@react-native-module/randombytes@4.0.0
Unpacked Size
600.90 kB
Size
161.63 kB
File Count
99
NPM Version
8.14.0
Node Version
16.14.2
Cumulative downloads
Total Downloads
Last day
-60%
2
Compared to previous day
Last week
-19.4%
25
Compared to previous week
Last month
182.8%
82
Compared to previous month
Last year
10.3%
1,271
Compared to previous year
2
1import { randomBytes } from "@react-native-module/randombytes"; 2 3// synchronous API 4const rand = randomBytes(4); 5 6// asynchronous API 7// uses iOS-side SecRandomCopyBytes 8randomBytes(4, (err, bytes) => { 9 // bytes is a Buffer object 10 console.log(bytes.toString("hex")); 11});
This module has peerDependency "react", "react-native"
A typical workflow:
npm install --save @react-native-module/randombytes
yarn add @react-native-module/randombytes
1react-native link
If Automatic installation failed you, dry your tears and read on.
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
Android
1// file: android/settings.gradle 2... 3 4include ':randombytes', ':app' 5project(':randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
1// file: android/app/build.gradle 2... 3 4dependencies { 5 ... 6 compile project(':randombytes') 7}
1... 2import com.bitgo.randombytes.RandomBytesPackage // import 3 4public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { 5 6 private ReactInstanceManager mReactInstanceManager; 7 private ReactRootView mReactRootView; 8 9 @Override 10 protected void onCreate(Bundle savedInstanceState) { 11 super.onCreate(savedInstanceState); 12 mReactRootView = new ReactRootView(this); 13 mReactInstanceManager = ReactInstanceManager.builder() 14 .setApplication(getApplication()) 15 .setBundleAssetName("index.android.bundle") 16 .setJSMainModuleName("index.android") 17 .addPackage(new MainReactPackage()) 18 .addPackage(new RandomBytesPackage()) // register package here 19 .setUseDeveloperSupport(BuildConfig.DEBUG) 20 .setInitialLifecycleState(LifecycleState.RESUMED) 21 .build(); 22 mReactRootView.startReactApplication(mReactInstanceManager, "AwesomeProject", null); 23 setContentView(mReactRootView); 24 } 25... 26
Windows
1react-native link react-native-randombytes
Depending on your project versions and the state of RN-Windows this may not always work. If it does not, a manual installation guide can be found here:
https://github.com/Microsoft/react-native-windows/blob/master/docs/LinkingLibrariesWindows.md
No vulnerabilities found.
No security vulnerabilities found.