summaryrefslogtreecommitdiff
path: root/shim.js
diff options
context:
space:
mode:
Diffstat (limited to 'shim.js')
-rw-r--r--shim.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/shim.js b/shim.js
new file mode 100644
index 0000000..61ec32e
--- /dev/null
+++ b/shim.js
@@ -0,0 +1,60 @@
+import {Buffer} from "@craftzdog/react-native-buffer";
+import 'react-native-get-random-values';
+
+global.Buffer = Buffer;
+console.log("shimming!!")
+global.lmao = "lmao";
+
+// Needed to polyfill random number generation
+
+// Polyfill crypto after process is polyfilled
+// const rnc = require("react-native-crypto");
+// import * as rnc from "react-native-crypto";
+// import * as expocrypto from "expo-crypto";
+// import * as crypb from "crypto-browserify";
+
+// console.log(global.crypto, "globl")
+// // console.log({rnc})
+// console.log({expocrypto})
+// // console.log({crypb})
+// // console.log({crypto, rnc, expocrypto, crypb})
+// // // Needed to polyfill crypto
+// const consolidate = {...global.crypto, ...expocrypto}
+// console.log({consolidate})
+// global.crypto = {...expocrypto}
+// console.log(global.crypto, "globl2")
+// Buffer polyfill - ensure this is first
+// const {Buffer} = require("@craftzdog/react-native-buffer");
+// global.Buffer = Buffer;
+
+
+
+// import 'react-native-get-random-values';
+
+// // Process polyfill
+// import process from 'process';
+// global.process = process;
+
+// // Use crypto-browserify for web compatibility
+// import crypto from 'crypto-browserify';
+// global.crypto = crypto;
+// Stream polyfill
+// import stream from 'stream-browserify';
+// global.stream = stream;
+
+// Crypto polyfill for tiny-secp256k1
+// import crypto from "react-native-crypto";
+// global.crypto = crypto
+// try {
+// import('react-native-crypto').then(crypto => {
+// if (!global.crypto) {
+// global.crypto = crypto.default || crypto;
+// }
+// });
+// } catch (e) {
+// console.warn('Failed to load react-native-crypto:', e);
+// }
+
+// Original code commented out
+// if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
+// if (typeof Buffer === 'undefined') global.Buffer = Buffer