23 lines
1001 B
Diff
23 lines
1001 B
Diff
diff --git a/node_modules/@noble/hashes/utils.js b/node_modules/@noble/hashes/utils.js
|
|
index c0519ac..b5ea31d 100644
|
|
--- a/node_modules/@noble/hashes/utils.js
|
|
+++ b/node_modules/@noble/hashes/utils.js
|
|
@@ -152,10 +152,12 @@ exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
|
|
* Secure PRNG. Uses `globalThis.crypto` or node.js crypto module.
|
|
*/
|
|
function randomBytes(bytesLength = 32) {
|
|
- if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
|
|
- return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
- }
|
|
- throw new Error('crypto.getRandomValues must be defined');
|
|
-}
|
|
+ try {
|
|
+ const randomBytes = require('expo-crypto').getRandomBytes;
|
|
+ return randomBytes(bytesLength);
|
|
+ } catch (e) {
|
|
+ throw new Error("The environment doesn't have randomBytes function and we couldn't use expo-crypto");
|
|
+ }
|
|
+}
|
|
exports.randomBytes = randomBytes;
|
|
//# sourceMappingURL=utils.js.map
|
|
\ No newline at end of file
|