@dubsdotapp/expo 0.2.48 → 0.2.49

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.
package/dist/index.mjs CHANGED
@@ -731,6 +731,28 @@ import bs582 from "bs58";
731
731
  // src/wallet/phantom-deeplink/crypto.ts
732
732
  import nacl from "tweetnacl";
733
733
  import bs58 from "bs58";
734
+ try {
735
+ nacl.randomBytes(1);
736
+ } catch {
737
+ const g = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : void 0;
738
+ if (g?.crypto?.getRandomValues) {
739
+ nacl.setPRNG((x, n) => {
740
+ const v = new Uint8Array(n);
741
+ g.crypto.getRandomValues(v);
742
+ for (let i = 0; i < n; i++) x[i] = v[i];
743
+ });
744
+ } else {
745
+ try {
746
+ const { getRandomValues } = __require("expo-crypto");
747
+ nacl.setPRNG((x, n) => {
748
+ const v = new Uint8Array(n);
749
+ getRandomValues(v);
750
+ for (let i = 0; i < n; i++) x[i] = v[i];
751
+ });
752
+ } catch {
753
+ }
754
+ }
755
+ }
734
756
  function generateKeyPair() {
735
757
  const kp = nacl.box.keyPair();
736
758
  return { publicKey: kp.publicKey, secretKey: kp.secretKey };