summaryrefslogtreecommitdiff
path: root/shim.js
blob: 61ec32e191a66554f9e5d9df3348dfa390795a17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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