From aadfe206f3233032d8742a17c1f21d4750946a41 Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 16 Jul 2025 14:54:44 +0700 Subject: aaaarggh!!! --- shim.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 shim.js (limited to 'shim.js') 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 -- cgit v1.2.3