@onekeyfe/react-native-get-random-values 3.0.162-alpha.272 → 3.0.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -0
  2. package/package.json +10 -4
package/README.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @onekeyfe/react-native-get-random-values
2
2
 
3
+ OneKey's React Native `crypto.getRandomValues` integration and native random
4
+ byte interface. Importing the package installs the global function only when
5
+ it is not already defined.
6
+
7
+ ## Installation and usage
8
+
9
+ The current wrapper requires Expo modules and uses `expo-crypto` from Expo
10
+ SDK 57. For a bare React Native app, first
11
+ [install and configure Expo modules](https://docs.expo.dev/bare/installing-expo-modules/)
12
+ with a compatible SDK.
13
+
14
+ ```sh
15
+ yarn add @onekeyfe/react-native-get-random-values react-native-nitro-modules
16
+ ```
17
+
18
+ `expo-crypto` and `fast-base64-decode` are runtime dependencies and are installed
19
+ with this package. Install iOS pods and rebuild the native application before
20
+ using the native path.
21
+
22
+ ```ts
23
+ import '@onekeyfe/react-native-get-random-values';
24
+
25
+ const bytes = new Uint8Array(16);
26
+ crypto.getRandomValues(bytes);
27
+ ```
28
+
29
+ ## API and limits
30
+
31
+ The global function fills the provided integer typed array in place and returns
32
+ it. Floating-point arrays are rejected. One call may request at most 65,536
33
+ bytes; requests above that size throw a quota error.
34
+
35
+ The wrapper prefers Expo Crypto when available, otherwise it uses the native
36
+ `getRandomBase64(byteLength)` method. A development debugger without synchronous
37
+ native-call support has an explicitly insecure `Math.random` fallback and emits
38
+ a warning. That fallback must not be mistaken for the native random-byte path.
39
+
40
+ The named `ReactNativeGetRandomValues` export exposes the Nitro object on native
41
+ platforms. See [src/index.tsx](src/index.tsx) for path selection and validation,
42
+ and [src/ReactNativeGetRandomValues.nitro.ts](src/ReactNativeGetRandomValues.nitro.ts)
43
+ for the native method signature.
44
+
45
+ ## Upstream attribution
46
+
3
47
  First, a sincere thank-you to Linus Unnebäck and the
4
48
  `react-native-get-random-values` maintainers for their excellent work 🙏
5
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-get-random-values",
3
- "version": "3.0.162-alpha.272",
3
+ "version": "3.0.163",
4
4
  "description": "react-native-get-random-values",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -50,17 +50,22 @@
50
50
  ],
51
51
  "repository": {
52
52
  "type": "git",
53
- "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-get-random-values.git"
53
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
54
+ "directory": "native-modules/react-native-get-random-values"
54
55
  },
55
56
  "author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
56
57
  "license": "MIT",
57
58
  "bugs": {
58
- "url": "https://github.com/OneKeyHQ/app-modules/react-native-get-random-values/issues"
59
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
59
60
  },
60
- "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-get-random-values#readme",
61
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-get-random-values#readme",
61
62
  "publishConfig": {
62
63
  "registry": "https://registry.npmjs.org/"
63
64
  },
65
+ "dependencies": {
66
+ "expo-crypto": "57.0.1",
67
+ "fast-base64-decode": "2.0.0"
68
+ },
64
69
  "devDependencies": {
65
70
  "@commitlint/config-conventional": "^19.8.1",
66
71
  "@eslint/compat": "^1.3.2",
@@ -89,6 +94,7 @@
89
94
  "typescript": "^5.9.2"
90
95
  },
91
96
  "peerDependencies": {
97
+ "expo": "*",
92
98
  "react": "*",
93
99
  "react-native": "*",
94
100
  "react-native-nitro-modules": "0.37.0"