@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.js CHANGED
@@ -803,6 +803,28 @@ var import_bs582 = __toESM(require("bs58"));
803
803
  // src/wallet/phantom-deeplink/crypto.ts
804
804
  var import_tweetnacl = __toESM(require("tweetnacl"));
805
805
  var import_bs58 = __toESM(require("bs58"));
806
+ try {
807
+ import_tweetnacl.default.randomBytes(1);
808
+ } catch {
809
+ const g = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : void 0;
810
+ if (g?.crypto?.getRandomValues) {
811
+ import_tweetnacl.default.setPRNG((x, n) => {
812
+ const v = new Uint8Array(n);
813
+ g.crypto.getRandomValues(v);
814
+ for (let i = 0; i < n; i++) x[i] = v[i];
815
+ });
816
+ } else {
817
+ try {
818
+ const { getRandomValues } = require("expo-crypto");
819
+ import_tweetnacl.default.setPRNG((x, n) => {
820
+ const v = new Uint8Array(n);
821
+ getRandomValues(v);
822
+ for (let i = 0; i < n; i++) x[i] = v[i];
823
+ });
824
+ } catch {
825
+ }
826
+ }
827
+ }
806
828
  function generateKeyPair() {
807
829
  const kp = import_tweetnacl.default.box.keyPair();
808
830
  return { publicKey: kp.publicKey, secretKey: kp.secretKey };