dop-wallet-v6 1.2.12 → 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,207 @@
1
+ # Selective Transparency Feature
2
+
3
+ The Selective Transparency feature allows DOP Wallet users to control the visibility of their assets, balances, NFTs, and profile information. Users can define privacy settings, manage whitelists, and generate cryptographic proofs for asset exposure.
4
+
5
+ ## Features
6
+
7
+ ### 1. User Profile Management
8
+ - Create and manage user profiles with username, bio, profile picture, and social links
9
+ - Profile customization with theme preferences and privacy alerts
10
+ - Profile validation and search functionality
11
+
12
+ ### 2. Asset Visibility Control
13
+ - Control visibility of token balances, NFTs, and transaction history
14
+ - Granular control per token/NFT contract address
15
+ - Global visibility settings with per-asset overrides
16
+
17
+ ### 3. Whitelist Management
18
+ - Manage a list of trusted addresses that can view private information
19
+ - Granular permissions for each whitelisted address
20
+ - Support for viewing balances, NFTs, transactions, and profile data
21
+
22
+ ### 4. Viewing Requests & Proofs
23
+ - Create and manage viewing requests from other users
24
+ - Generate cryptographic proofs for authorized visibility
25
+ - Proof verification and expiration management
26
+
27
+ ## Usage Examples
28
+
29
+ ### Profile Management
30
+
31
+ ```typescript
32
+ import { ProfileManager } from 'dop-wallet-v3';
33
+
34
+ const profileManager = new ProfileManager();
35
+
36
+ // Create a user profile
37
+ const profile = await profileManager.createProfile('wallet-id', {
38
+ username: 'alice',
39
+ bio: 'DeFi enthusiast',
40
+ profilePicture: 'https://example.com/avatar.jpg',
41
+ socialLinks: {
42
+ twitter: 'https://twitter.com/alice',
43
+ github: 'https://github.com/alice'
44
+ }
45
+ });
46
+
47
+ // Update profile
48
+ await profileManager.updateProfile('wallet-id', {
49
+ bio: 'Privacy-focused DeFi user'
50
+ });
51
+
52
+ // Set profile customization
53
+ await profileManager.setCustomization('wallet-id', {
54
+ theme: 'dark',
55
+ displayPreferences: {
56
+ currencyFormat: 'USD',
57
+ numberFormat: 'abbreviated',
58
+ dateFormat: 'MM/DD/YYYY',
59
+ timeFormat: '24h'
60
+ },
61
+ privacyAlerts: {
62
+ newViewingRequest: true,
63
+ profileUpdate: false,
64
+ assetVisibilityChange: true
65
+ }
66
+ });
67
+ ```
68
+
69
+ ### Selective Transparency Settings
70
+
71
+ ```typescript
72
+ import { SelectiveTransparencyManager } from 'dop-wallet-v3';
73
+
74
+ const transparencyManager = new SelectiveTransparencyManager();
75
+
76
+ // Create default privacy settings
77
+ const settings = await transparencyManager.createDefaultSettings('wallet-id');
78
+
79
+ // Update global visibility settings
80
+ await transparencyManager.updateSettings('wallet-id', {
81
+ assetVisibility: {
82
+ showTokenBalances: false, // Hide token balances by default
83
+ showNFTs: true, // Show NFTs
84
+ showTransactionHistory: false, // Hide transaction history
85
+ showAddresses: false // Hide addresses
86
+ }
87
+ });
88
+
89
+ // Set specific token visibility
90
+ await transparencyManager.setTokenVisibility('wallet-id', '0x...tokenAddress', {
91
+ isVisible: true,
92
+ showBalance: true,
93
+ showTransactions: false
94
+ });
95
+
96
+ // Set NFT collection visibility
97
+ await transparencyManager.setNFTVisibility('wallet-id', '0x...nftAddress', {
98
+ isVisible: true,
99
+ showCollection: true,
100
+ showTransactions: false
101
+ });
102
+ ```
103
+
104
+ ### Whitelist Management
105
+
106
+ ```typescript
107
+ // Add address to whitelist with specific permissions
108
+ await transparencyManager.addToWhitelist('wallet-id', '0x...trustedAddress', {
109
+ viewBalances: true,
110
+ viewNFTs: true,
111
+ viewTransactions: false,
112
+ viewProfile: true
113
+ });
114
+
115
+ // Check if address has permission
116
+ const canViewBalances = await transparencyManager.checkWhitelistPermission(
117
+ 'wallet-id',
118
+ '0x...address',
119
+ 'viewBalances'
120
+ );
121
+
122
+ // Remove from whitelist
123
+ await transparencyManager.removeFromWhitelist('wallet-id', '0x...address');
124
+ ```
125
+
126
+ ### Viewing Requests & Proofs
127
+
128
+ ```typescript
129
+ // Create a viewing request
130
+ const request = await transparencyManager.createViewingRequest(
131
+ 'requester-id',
132
+ 'wallet-id',
133
+ 'balance',
134
+ '0x...tokenAddress',
135
+ 'Can I see your USDC balance?'
136
+ );
137
+
138
+ // Respond to viewing request
139
+ await transparencyManager.respondToViewingRequest(request.id, 'approved');
140
+
141
+ // Generate visibility proof (requires whitelist permission)
142
+ const proof = await transparencyManager.generateVisibilityProof(
143
+ 'wallet-id',
144
+ 'requester-id',
145
+ 'balance',
146
+ '0x...tokenAddress'
147
+ );
148
+
149
+ // Verify proof
150
+ const isValid = await transparencyManager.verifyVisibilityProof(proof.id);
151
+ ```
152
+
153
+ ### Event Handling
154
+
155
+ ```typescript
156
+ import { setSelectiveTransparencyCallback } from 'dop-wallet-v3';
157
+
158
+ // Set up event listener
159
+ setSelectiveTransparencyCallback((event) => {
160
+ switch (event.type) {
161
+ case 'profile_updated':
162
+ console.log('Profile updated for wallet:', event.data.walletId);
163
+ break;
164
+ case 'settings_changed':
165
+ console.log('Privacy settings changed for wallet:', event.data.walletId);
166
+ break;
167
+ case 'viewing_request':
168
+ console.log('New viewing request:', event.data);
169
+ break;
170
+ case 'proof_generated':
171
+ console.log('Visibility proof generated:', event.data);
172
+ break;
173
+ }
174
+ });
175
+ ```
176
+
177
+ ## Security Features
178
+
179
+ 1. **Cryptographic Proofs**: All visibility proofs are cryptographically generated and time-limited
180
+ 2. **Whitelist-Only Proof Generation**: Only explicitly whitelisted addresses can generate visibility proofs
181
+ 3. **Granular Permissions**: Fine-grained control over what information each address can view
182
+ 4. **Expiration Management**: Viewing requests and proofs automatically expire
183
+ 5. **Validation**: All profile data and settings are validated before storage
184
+
185
+ ## Integration Notes
186
+
187
+ - The feature is fully integrated into the main DOP Wallet SDK exports
188
+ - All operations are asynchronous and return Promises
189
+ - Profile and transparency managers maintain in-memory state (consider persisting to storage in production)
190
+ - Event callbacks allow for real-time UI updates
191
+ - All methods include proper error handling and sanitization
192
+
193
+ ## Testing
194
+
195
+ The feature includes comprehensive unit tests covering:
196
+ - Profile creation, updates, and validation
197
+ - Privacy settings management
198
+ - Token and NFT visibility controls
199
+ - Whitelist management
200
+ - Viewing request workflows
201
+ - Visibility proof generation and verification
202
+ - Error handling and edge cases
203
+
204
+ Run tests with:
205
+ ```bash
206
+ npm test -- --grep "ProfileManager|SelectiveTransparencyManager"
207
+ ```
@@ -0,0 +1,180 @@
1
+ # Web Worker Troubleshooting Guide for React Native
2
+
3
+ ## The Issue
4
+
5
+ If you're seeing this error:
6
+ ```
7
+ ERROR node_modules/web-worker/cjs/node.js: node_modules/web-worker/cjs/node.js:Invalid call at line 201: import(mod)
8
+ ```
9
+
10
+ This occurs because the `web-worker` package contains Node.js-specific code that uses dynamic imports (`import()`), which are not supported in React Native's Metro bundler.
11
+
12
+ ## Root Cause
13
+
14
+ The `web-worker` package is a dependency of `circomlibjs` (used by dop-wallet-v6 for cryptographic operations). Even though we provide polyfills, Metro is still trying to parse the original package files, causing the error.
15
+
16
+ ## Solution Steps
17
+
18
+ ### 1. Update Your Metro Configuration
19
+
20
+ Ensure your `metro.config.js` includes the updated configuration with proper blocking:
21
+
22
+ ```javascript
23
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
24
+ const path = require('path');
25
+
26
+ const defaultConfig = getDefaultConfig(__dirname);
27
+
28
+ const config = {
29
+ resolver: {
30
+ // Node.js core module aliases - CRITICAL for fixing ffjavascript dependencies
31
+ alias: {
32
+ // Primary Node.js modules required by ffjavascript
33
+ 'os': require.resolve('./node-polyfills/os-polyfill.js'),
34
+ 'crypto': require.resolve('crypto-browserify'),
35
+ 'stream': require.resolve('stream-browserify'),
36
+ 'buffer': require.resolve('buffer'),
37
+ 'events': require.resolve('events'),
38
+ 'util': require.resolve('util'),
39
+ 'assert': require.resolve('assert'),
40
+ 'process': require.resolve('process/browser'),
41
+
42
+ // Additional modules that might be needed
43
+ 'path': require.resolve('path-browserify'),
44
+ 'url': require.resolve('url'),
45
+ 'querystring': require.resolve('querystring-es3'),
46
+ 'http': require.resolve('stream-http'),
47
+ 'https': require.resolve('https-browserify'),
48
+ 'zlib': require.resolve('browserify-zlib'),
49
+
50
+ // Web Worker compatibility - CRITICAL: Block the problematic package
51
+ 'web-worker': require.resolve('./node-polyfills/web-worker-polyfill.js'),
52
+ 'web-worker/cjs/node.js': require.resolve('./node-polyfills/web-worker-polyfill.js'),
53
+ 'web-worker/cjs/node': require.resolve('./node-polyfills/web-worker-polyfill.js'),
54
+
55
+ // Disable problematic WASM-related modules for React Native
56
+ 'wasmcurves': require.resolve('./node-polyfills/wasm-fallback.js'),
57
+ 'wasmbuilder': require.resolve('./node-polyfills/wasm-fallback.js'),
58
+ },
59
+
60
+ // Extra node modules for Metro resolver
61
+ extraNodeModules: {
62
+ 'os': require.resolve('./node-polyfills/os-polyfill.js'),
63
+ 'crypto': require.resolve('crypto-browserify'),
64
+ 'stream': require.resolve('stream-browserify'),
65
+ 'buffer': require.resolve('buffer'),
66
+ 'events': require.resolve('events'),
67
+ 'util': require.resolve('util'),
68
+ 'assert': require.resolve('assert'),
69
+ 'process': require.resolve('process/browser'),
70
+ 'path': require.resolve('path-browserify'),
71
+ 'url': require.resolve('url'),
72
+ 'querystring': require.resolve('querystring-es3'),
73
+ 'http': require.resolve('stream-http'),
74
+ 'https': require.resolve('https-browserify'),
75
+ 'zlib': require.resolve('browserify-zlib'),
76
+ 'web-worker': require.resolve('./node-polyfills/web-worker-polyfill.js'),
77
+ 'wasmcurves': require.resolve('./node-polyfills/wasm-fallback.js'),
78
+ 'wasmbuilder': require.resolve('./node-polyfills/wasm-fallback.js'),
79
+ },
80
+
81
+ // Platforms - ensure React Native takes precedence
82
+ platforms: ['native', 'react-native', 'android', 'ios', 'web'],
83
+
84
+ // Asset extensions - include WASM if needed (though we're disabling it)
85
+ assetExts: [...defaultConfig.resolver.assetExts, 'wasm'],
86
+
87
+ // Source extensions - ensure TypeScript and JavaScript are handled
88
+ sourceExts: [...defaultConfig.resolver.sourceExts, 'cjs'],
89
+
90
+ // Block problematic modules from being processed by Metro
91
+ blockList: [
92
+ // Block the original web-worker package to prevent dynamic import errors
93
+ /node_modules\/web-worker\/cjs\/node\.js$/,
94
+ /node_modules\/web-worker\/lib\/node\.js$/,
95
+ // Block other potential problematic files
96
+ /.*\/node_modules\/web-worker\/.*\.node$/,
97
+ ],
98
+ },
99
+
100
+ transformer: {
101
+ // Disable minification for debugging if needed
102
+ minifierConfig: {
103
+ keep_fnames: true,
104
+ mangle: {
105
+ keep_fnames: true,
106
+ },
107
+ },
108
+ },
109
+ };
110
+
111
+ module.exports = mergeConfig(defaultConfig, config);
112
+ ```
113
+
114
+ ### 2. Copy Updated Polyfills
115
+
116
+ Ensure you have copied the latest polyfill files from `new-dop-wallet-v3/node-polyfills/` to your React Native project root:
117
+
118
+ - `os-polyfill.js`
119
+ - `web-worker-polyfill.js` (updated version)
120
+ - `wasm-fallback.js`
121
+
122
+ ### 3. Clear Metro Cache
123
+
124
+ After updating the configuration, clear Metro's cache:
125
+
126
+ ```bash
127
+ npx react-native start --reset-cache
128
+ ```
129
+
130
+ ### 4. Alternative Solution: Package Resolution Override
131
+
132
+ If the above doesn't work, you can also try adding package resolution overrides to your `package.json`:
133
+
134
+ ```json
135
+ {
136
+ "name": "your-react-native-app",
137
+ "dependencies": {
138
+ // ... your dependencies
139
+ },
140
+ "resolutions": {
141
+ "web-worker": "file:./node-polyfills/web-worker-polyfill.js"
142
+ },
143
+ "overrides": {
144
+ "web-worker": "file:./node-polyfills/web-worker-polyfill.js"
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### 5. Verification
150
+
151
+ To verify the fix is working:
152
+
153
+ 1. Start Metro with cache reset: `npx react-native start --reset-cache`
154
+ 2. Run your app: `npx react-native run-android` or `npx react-native run-ios`
155
+ 3. Check that you see the polyfill warning instead of the error:
156
+ ```
157
+ Web Worker polyfill: Web Workers are not supported in React Native. Operations will run synchronously.
158
+ ```
159
+
160
+ ## Why This Happens
161
+
162
+ 1. **Dynamic imports**: The `web-worker` package uses `import()` syntax which Metro cannot process
163
+ 2. **Node.js specific code**: The package contains code designed for Node.js environments
164
+ 3. **Dependency chain**: Even though you don't directly use web-worker, it's pulled in by circomlibjs
165
+
166
+ ## Prevention
167
+
168
+ - Always use the provided Metro configuration when integrating dop-wallet-v6
169
+ - Copy all polyfill files, not just the ones you think you need
170
+ - Test with cache reset after any configuration changes
171
+
172
+ ## Still Having Issues?
173
+
174
+ If you're still experiencing problems:
175
+
176
+ 1. Check that your Metro configuration exactly matches the example
177
+ 2. Verify all polyfill files are copied to the correct location
178
+ 3. Ensure the paths in your Metro config point to the actual polyfill files
179
+ 4. Try deleting `node_modules` and reinstalling
180
+ 5. Check that you're not importing dop-wallet-v6 before the required shims
package/issuev3.md ADDED
@@ -0,0 +1,78 @@
1
+ Integrating dop-wallet-v6 into a React Native 0.81 (new architecture) app consistently fails during Metro bundling before the app can run. All failures vanish if dop-wallet-v6 is removed. The errors originate from transitive deps brought in by dop-wallet-v6 (notably ffjavascript, web-worker, wasmcurves, wasmbuilder) that expect Node.js or Web Worker environments. React Native’s Metro/Hermes does not provide those environments by default.
2
+
3
+ Key blockers observed:
4
+
5
+ • ffjavascript does require('os') → Metro can’t resolve Node core module os.
6
+ • After stubbing/aliasing os, Metro hits web-worker/cjs/node.js and fails on import(mod) (dynamic import in CJS path), which is incompatible in this RN+Metro context.
7
+ • Prior to this, we also had to polyfill other Node core modules (assert, events, process, buffer) just to progress to the next error.
8
+ When dop-wallet-v6 is uninstalled (and its import commented out), the app runs normally.
9
+
10
+
11
+ Environment
12
+
13
+ • Platform: React Native 0.81.x (New Architecture enabled)
14
+ • Bundler/Engine: Metro + Hermes (RN default)
15
+ • OS/Dev machine: macOS (Intel)
16
+ • Crypto/Polyfills used in app:
17
+ o react-native-quick-crypto (polyfills Node crypto)
18
+ o react-native-get-random-values
19
+ o Manual/global polyfills for process, Buffer, stream, util, assert, events
20
+ o Local “os” stub (details below)
21
+ Note: RN ≥0.76 no longer ships Node polyfills automatically. Metro requires explicit polyfills or aliases for Node core modules.
22
+
23
+ Some Code Snippets
24
+
25
+ Added polyfills.js and import it at the very top of index.js:
26
+ // polyfills.js
27
+ import 'react-native-get-random-values';
28
+ import 'react-native-quick-crypto';
29
+
30
+ if (typeof global.process === 'undefined') global.process = require('process');
31
+ if (typeof global.Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
32
+
33
+ // Minimal 'os' ponyfill to get past ffjavascript's 'require("os")'
34
+ // (Note: a global doesn’t satisfy require('os'); see metro alias below)
35
+ global.os = {
36
+ platform: () => 'react-native',
37
+ homedir: () => '/',
38
+ tmpdir: () => '/tmp',
39
+ };
40
+
41
+ global.stream = require('stream-browserify');
42
+ global.util = require('util');
43
+ global.assert = require('assert');
44
+ global.events = require('events');
45
+
46
+ In metro.config.js, alias Node core os to our stub (this is what actually satisfies require('os') at bundle-time):
47
+ // force `require('os')` to hit our stub file
48
+ os: require.resolve('./polyfills.js'),
49
+
50
+
51
+ Errors & Logs
52
+ ➢ Missing Node core module (os):
53
+ BUNDLE ./index.js
54
+ ERROR Error: Unable to resolve module os from node_modules/ffjavascript/build/main.cjs:
55
+ os could not be found within the project or in these directories: node_modules
56
+
57
+ 3 | var crypto = require('crypto');
58
+ 4 | var wasmcurves = require('wasmcurves');
59
+ > 5 | var os = require('os');
60
+ ^
61
+ 6 | var Worker = require('web-worker');
62
+ • Root: ffjavascript requires the Node core module os.
63
+ • Workaround tried:
64
+ • Setting global.os = { ... } alone is not enough because require('os') needs a module, not a global.
65
+ • Aliasing os to a local stub in metro.config.js resolves bundling past this point.
66
+
67
+
68
+
69
+
70
+ ➢ Next blocker from web-worker:
71
+ ERROR node_modules/web-worker/cjs/node.js: node_modules/web-worker/cjs/node.js: Invalid call at line 201: import(mod)
72
+
73
+ Analysis (why this breaks on RN)
74
+
75
+ 1. Node core deps in transitive packages (ffjavascript → require('os')) aren’t available in RN. We can alias some, but it’s brittle and incomplete.
76
+ 2. Web Worker dependency (web-worker, wasmbuilder) assumes either Node (worker threads / dynamic loading) or browser (DOM Workers). React Native has neither by default. Metro/Hermes do not support those code paths out of the box.
77
+ 3. Dynamic import in a CJS Node path (web-worker/cjs/node.js → import(mod)) is not compatible with RN/Metro bundle stage in this context.
78
+ 4. Potential WASM assets (wasmcurves, wasmbuilder) usually require Metro config for *.wasm and a runtime that supports WASM in Hermes (partial/experimental). Even if we get past web-worker, WASM loading likely becomes the next blocker unless the SDK ships an RN-ready path.
@@ -34,8 +34,10 @@ const config = {
34
34
  'https': require.resolve('https-browserify'),
35
35
  'zlib': require.resolve('browserify-zlib'),
36
36
 
37
- // Web Worker compatibility - redirect to React Native compatible version
37
+ // Web Worker compatibility - CRITICAL: Block the problematic package
38
38
  'web-worker': require.resolve('./node-polyfills/web-worker-polyfill.js'),
39
+ 'web-worker/cjs/node.js': require.resolve('./node-polyfills/web-worker-polyfill.js'),
40
+ 'web-worker/cjs/node': require.resolve('./node-polyfills/web-worker-polyfill.js'),
39
41
 
40
42
  // Disable problematic WASM-related modules for React Native
41
43
  'wasmcurves': require.resolve('./node-polyfills/wasm-fallback.js'),
@@ -71,6 +73,15 @@ const config = {
71
73
 
72
74
  // Source extensions - ensure TypeScript and JavaScript are handled
73
75
  sourceExts: [...defaultConfig.resolver.sourceExts, 'cjs'],
76
+
77
+ // Block problematic modules from being processed by Metro
78
+ blockList: [
79
+ // Block the original web-worker package to prevent dynamic import errors
80
+ /node_modules\/web-worker\/cjs\/node\.js$/,
81
+ /node_modules\/web-worker\/lib\/node\.js$/,
82
+ // Block other potential problematic files
83
+ /.*\/node_modules\/web-worker\/.*\.node$/,
84
+ ],
74
85
  },
75
86
 
76
87
  transformer: {
@@ -0,0 +1,130 @@
1
+ /**
2
+ * OS module polyfill for React Native
3
+ *
4
+ * This addresses the specific error:
5
+ * "Error: Unable to resolve module os from node_modules/ffjavascript/build/main.cjs"
6
+ *
7
+ * ffjavascript uses os.platform() and other OS-specific functions.
8
+ * This polyfill provides React Native compatible alternatives.
9
+ */
10
+
11
+ module.exports = {
12
+ /**
13
+ * Returns the operating system platform
14
+ * @returns {string} Always returns 'react-native' to indicate React Native environment
15
+ */
16
+ platform: () => 'react-native',
17
+
18
+ /**
19
+ * Returns the platform-specific end-of-line marker
20
+ * @returns {string} Always returns '\n' for consistency
21
+ */
22
+ EOL: '\n',
23
+
24
+ /**
25
+ * Returns the home directory path (stubbed for React Native)
26
+ * @returns {string} Returns a placeholder since React Native doesn't have home directories
27
+ */
28
+ homedir: () => '/react-native-home',
29
+
30
+ /**
31
+ * Returns the temporary directory path (stubbed for React Native)
32
+ * @returns {string} Returns a placeholder since React Native handles temp differently
33
+ */
34
+ tmpdir: () => '/react-native-tmp',
35
+
36
+ /**
37
+ * Returns hostname (stubbed for React Native)
38
+ * @returns {string} Returns a placeholder hostname
39
+ */
40
+ hostname: () => 'react-native-device',
41
+
42
+ /**
43
+ * Returns the operating system type (stubbed for React Native)
44
+ * @returns {string} Always returns 'ReactNative'
45
+ */
46
+ type: () => 'ReactNative',
47
+
48
+ /**
49
+ * Returns the operating system release (stubbed for React Native)
50
+ * @returns {string} Returns a placeholder version
51
+ */
52
+ release: () => '1.0.0',
53
+
54
+ /**
55
+ * Returns system uptime (stubbed for React Native)
56
+ * @returns {number} Returns a placeholder uptime in seconds
57
+ */
58
+ uptime: () => 1000,
59
+
60
+ /**
61
+ * Returns load averages (stubbed for React Native)
62
+ * @returns {number[]} Returns placeholder load averages
63
+ */
64
+ loadavg: () => [0, 0, 0],
65
+
66
+ /**
67
+ * Returns total system memory (stubbed for React Native)
68
+ * @returns {number} Returns placeholder memory amount in bytes
69
+ */
70
+ totalmem: () => 1073741824, // 1GB placeholder
71
+
72
+ /**
73
+ * Returns free system memory (stubbed for React Native)
74
+ * @returns {number} Returns placeholder free memory amount in bytes
75
+ */
76
+ freemem: () => 536870912, // 512MB placeholder
77
+
78
+ /**
79
+ * Returns CPU information (stubbed for React Native)
80
+ * @returns {Object[]} Returns placeholder CPU info
81
+ */
82
+ cpus: () => [
83
+ {
84
+ model: 'React Native CPU',
85
+ speed: 2000,
86
+ times: {
87
+ user: 100,
88
+ nice: 0,
89
+ sys: 50,
90
+ idle: 1000,
91
+ irq: 0
92
+ }
93
+ }
94
+ ],
95
+
96
+ /**
97
+ * Returns network interfaces (stubbed for React Native)
98
+ * @returns {Object} Returns placeholder network interface info
99
+ */
100
+ networkInterfaces: () => ({
101
+ 'react-native': [
102
+ {
103
+ address: '127.0.0.1',
104
+ netmask: '255.0.0.0',
105
+ family: 'IPv4',
106
+ mac: '00:00:00:00:00:00',
107
+ internal: true,
108
+ cidr: '127.0.0.1/8'
109
+ }
110
+ ]
111
+ }),
112
+
113
+ /**
114
+ * Returns system architecture (stubbed for React Native)
115
+ * @returns {string} Returns a placeholder architecture
116
+ */
117
+ arch: () => 'react-native',
118
+
119
+ /**
120
+ * Returns user info (stubbed for React Native)
121
+ * @returns {Object} Returns placeholder user info
122
+ */
123
+ userInfo: () => ({
124
+ uid: -1,
125
+ gid: -1,
126
+ username: 'react-native-user',
127
+ homedir: '/react-native-home',
128
+ shell: null
129
+ })
130
+ };
@@ -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;