dop-wallet-v6 1.2.11 → 1.2.13

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "web-worker-polyfill",
3
+ "version": "1.0.0",
4
+ "description": "React Native polyfill for web-worker package",
5
+ "main": "web-worker-polyfill.js",
6
+ "keywords": ["react-native", "web-worker", "polyfill"],
7
+ "author": "DOP Wallet Team",
8
+ "license": "MIT"
9
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WASM fallback for React Native
3
+ *
4
+ * This provides fallbacks for wasmcurves and wasmbuilder packages
5
+ * that are incompatible with React Native's JavaScript engine.
6
+ *
7
+ * These packages are used by ffjavascript for optimized curve operations,
8
+ * but circomlibjs should fall back to pure JavaScript implementations
9
+ * when WASM is not available.
10
+ */
11
+
12
+ console.warn('WASM fallback: WebAssembly operations will use JavaScript implementations in React Native.');
13
+
14
+ // Mock the wasmcurves/wasmbuilder exports
15
+ module.exports = {
16
+ // Mock curve operations - these should not be called if circomlibjs is properly configured
17
+ bn128: {
18
+ Fr: null,
19
+ G1: null,
20
+ G2: null,
21
+ },
22
+
23
+ // Mock WASM builder - these should not be called if circomlibjs is properly configured
24
+ buildBn128: () => {
25
+ throw new Error('WASM curve operations not supported in React Native. Ensure circomlibjs is using JavaScript fallbacks.');
26
+ },
27
+
28
+ // Mock any other common exports
29
+ buildBls12381: () => {
30
+ throw new Error('WASM curve operations not supported in React Native. Ensure circomlibjs is using JavaScript fallbacks.');
31
+ }
32
+ };
33
+
34
+ // Also support default export
35
+ module.exports.default = module.exports;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Web Worker polyfill for React Native
3
+ *
4
+ * This addresses the specific error:
5
+ * "node_modules/web-worker/cjs/node.js: Invalid call at line 201: import(mod)"
6
+ *
7
+ * Since React Native doesn't support Web Workers or dynamic imports,
8
+ * we completely replace the web-worker module with a stub that prevents
9
+ * the problematic Node.js code from executing.
10
+ */
11
+
12
+ console.warn('Web Worker polyfill: Web Workers are not supported in React Native. Operations will run synchronously.');
13
+
14
+ /**
15
+ * Complete web-worker module replacement for React Native
16
+ * This prevents the original web-worker package from loading entirely
17
+ */
18
+
19
+ // Mock Web Worker constructor that prevents instantiation
20
+ class ReactNativeWebWorker {
21
+ constructor(scriptURL, options = {}) {
22
+ // Don't throw immediately - some libraries check for Worker availability first
23
+ console.warn('Web Worker constructor called in React Native - falling back to synchronous execution');
24
+
25
+ // Provide minimal interface that libraries expect
26
+ this.onmessage = null;
27
+ this.onerror = null;
28
+ this.onmessageerror = null;
29
+ this.terminate = () => {
30
+ console.warn('Worker.terminate() called - no-op in React Native');
31
+ };
32
+ this.postMessage = (message) => {
33
+ console.warn('Worker.postMessage() called - no-op in React Native', message);
34
+ };
35
+ }
36
+ }
37
+
38
+ // Primary export - this is what gets imported when someone does require('web-worker')
39
+ module.exports = ReactNativeWebWorker;
40
+
41
+ // ES6 default export
42
+ module.exports.default = ReactNativeWebWorker;
43
+
44
+ // Named exports that the web-worker package might provide
45
+ module.exports.Worker = ReactNativeWebWorker;
46
+
47
+ // Additional exports to fully replace the web-worker module interface
48
+ module.exports.isMainThread = true;
49
+ module.exports.parentPort = null;
50
+ module.exports.threadId = 0;
51
+ module.exports.workerData = null;
52
+
53
+ // Mock MessagePort for completeness
54
+ module.exports.MessagePort = class MockMessagePort {
55
+ constructor() {
56
+ this.onmessage = null;
57
+ this.onmessageerror = null;
58
+ }
59
+ postMessage() {
60
+ console.warn('MessagePort.postMessage() called - no-op in React Native');
61
+ }
62
+ start() {}
63
+ close() {}
64
+ };
65
+
66
+ // Mock MessageChannel for completeness
67
+ module.exports.MessageChannel = class MockMessageChannel {
68
+ constructor() {
69
+ this.port1 = new module.exports.MessagePort();
70
+ this.port2 = new module.exports.MessagePort();
71
+ }
72
+ };
73
+
74
+ // Prevent any dynamic imports or Node.js specific functionality
75
+ if (typeof global !== 'undefined') {
76
+ global.Worker = global.Worker || ReactNativeWebWorker;
77
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "scripts": {
3
+ "test-rn-integration": "node test-react-native-integration.js",
4
+ "verify-rn-deps": "node verify-react-native-deps.js"
5
+ },
6
+ "rn-integration-deps": {
7
+ "required": [
8
+ "@react-native-async-storage/async-storage",
9
+ "react-native-get-random-values",
10
+ "crypto-browserify",
11
+ "stream-browserify",
12
+ "buffer",
13
+ "events",
14
+ "util",
15
+ "assert",
16
+ "process",
17
+ "path-browserify",
18
+ "url",
19
+ "querystring-es3",
20
+ "stream-http",
21
+ "https-browserify",
22
+ "browserify-zlib"
23
+ ],
24
+ "polyfills": [
25
+ "node-polyfills/os-polyfill.js",
26
+ "node-polyfills/web-worker-polyfill.js",
27
+ "node-polyfills/wasm-fallback.js"
28
+ ]
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "dop-wallet-v6",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "DOP Wallet SDK, compatible with mobile, browser and nodejs environments.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "dist/**/*",
9
- "*.js"
9
+ "*.js",
10
+ "*.md",
11
+ "node-polyfills/**/*",
12
+ "metro.config.react-native.example.js",
13
+ "package-rn-integration.json"
10
14
  ],
11
15
  "exports": {
12
16
  ".": "./dist/index.js",