fix(deps): replace react-native-securerandom with react-native-get-random-values#4099
fix(deps): replace react-native-securerandom with react-native-get-random-values#4099a-khushal wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the react-native-securerandom dependency and updates utils/LndMobileUtils.ts to use the standard crypto.getRandomValues API for generating random bytes. The review feedback correctly identifies that the react-native-get-random-values package is missing from package.json and that its polyfill must be imported in the application's entry file to prevent a ReferenceError at runtime.
| "react-native-safe-area-context": "5.6.2", | ||
| "react-native-screens": "4.19.0", | ||
| "react-native-securerandom": "1.0.1", | ||
|
|
There was a problem hiding this comment.
The dependency react-native-get-random-values is missing from package.json. The pull request title and the changes in utils/LndMobileUtils.ts indicate that this package is intended to replace react-native-securerandom. Without adding it to the dependencies, the application will fail to resolve the package and crash when attempting to use crypto.getRandomValues.
| "react-native-get-random-values": "1.11.0", |
There was a problem hiding this comment.
it was already an existing dependency in package.json and we've removed it to use the globalThis.crypto.getRandomValues()
|
|
||
| const random = await generateSecureRandom(32); | ||
| const random = new Uint8Array(32); | ||
| crypto.getRandomValues(random); |
There was a problem hiding this comment.
Using crypto.getRandomValues in a React Native environment requires the react-native-get-random-values polyfill to be imported at the very beginning of your application's entry file (e.g., index.js or App.tsx). Please ensure this import is added to avoid a ReferenceError: crypto is not defined at runtime.
There was a problem hiding this comment.
imported in index.js (line 11), no changes needed.
b7cefe0 to
92cdffb
Compare
92cdffb to
977c509
Compare
Description
Relates to issue: ZEUS-4095
This pull request is categorized as a:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patternsyarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
On-device
Remote
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: