@moontra/moonui-pro 2.32.32 → 2.32.33

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.
package/dist/index.mjs CHANGED
@@ -100,20 +100,19 @@ var init_cli_token_reader = __esm({
100
100
  return this.instance;
101
101
  }
102
102
  /**
103
- * Generate device fingerprint compatible with CLI format
104
- * Format: platform-hostname-username_hash (8 chars)
103
+ * Generate device fingerprint compatible with CLI format but enhanced for browser security
104
+ * Format: platform-hostname-username_hash-machine_hash (enhanced browser version)
105
105
  */
106
106
  async getDeviceFingerprint() {
107
107
  try {
108
108
  let platform2 = "unknown";
109
109
  if (typeof window !== "undefined") {
110
110
  const userAgent = navigator.userAgent.toLowerCase();
111
- const navigatorPlatform = navigator.platform.toLowerCase();
112
- if (navigatorPlatform.includes("mac") || userAgent.includes("mac")) {
111
+ if (userAgent.includes("mac") || userAgent.includes("darwin")) {
113
112
  platform2 = "darwin";
114
- } else if (navigatorPlatform.includes("win") || userAgent.includes("windows")) {
113
+ } else if (userAgent.includes("win") || userAgent.includes("windows")) {
115
114
  platform2 = "win32";
116
- } else if (navigatorPlatform.includes("linux") || userAgent.includes("linux")) {
115
+ } else if (userAgent.includes("linux") || userAgent.includes("x11")) {
117
116
  platform2 = "linux";
118
117
  }
119
118
  }
@@ -125,14 +124,18 @@ var init_cli_token_reader = __esm({
125
124
  }
126
125
  const username = process.env.NEXT_PUBLIC_MOONUI_USERNAME || "dev-user";
127
126
  const usernameHash = await this.sha256Hash(username);
128
- const fingerprint = `${platform2}-${hostname}-${usernameHash}`;
129
- console.log("[MoonUI Pro] Browser device fingerprint generated:", {
127
+ const machineId = await this.generateBrowserMachineId();
128
+ const fingerprint = `${platform2}-${hostname}-${usernameHash}-${machineId}`;
129
+ console.log("[MoonUI Pro] Enhanced browser device fingerprint generated:", {
130
130
  platform: platform2,
131
131
  hostname,
132
132
  username: username.substring(0, 3) + "***",
133
133
  // Partial logging for privacy
134
134
  usernameHash,
135
- fingerprint
135
+ machineId: machineId.substring(0, 4) + "***",
136
+ // Partial logging for privacy
137
+ fingerprint: fingerprint.substring(0, 20) + "***"
138
+ // Partial logging for privacy
136
139
  });
137
140
  return fingerprint;
138
141
  } catch (error) {
@@ -140,6 +143,113 @@ var init_cli_token_reader = __esm({
140
143
  return "browser-fallback-device";
141
144
  }
142
145
  }
146
+ /**
147
+ * Generate browser-specific machine ID using multiple browser characteristics
148
+ * This prevents token sharing between different browsers/machines
149
+ */
150
+ async generateBrowserMachineId() {
151
+ if (typeof window === "undefined") {
152
+ return "ssr-fallback";
153
+ }
154
+ try {
155
+ const characteristics = [];
156
+ characteristics.push(`${screen.width}x${screen.height}`);
157
+ characteristics.push(`${screen.colorDepth}`);
158
+ characteristics.push(`${window.devicePixelRatio || 1}`);
159
+ characteristics.push(navigator.userAgent);
160
+ characteristics.push(navigator.language);
161
+ characteristics.push(`${navigator.hardwareConcurrency || 0}`);
162
+ characteristics.push(`${navigator.maxTouchPoints || 0}`);
163
+ characteristics.push(Intl.DateTimeFormat().resolvedOptions().timeZone);
164
+ const canvasFingerprint = await this.generateCanvasFingerprint();
165
+ characteristics.push(canvasFingerprint);
166
+ const webglFingerprint = this.generateWebGLFingerprint();
167
+ characteristics.push(webglFingerprint);
168
+ const audioFingerprint = await this.generateAudioFingerprint();
169
+ characteristics.push(audioFingerprint);
170
+ const combined = characteristics.join("|");
171
+ const machineHash = await this.sha256Hash(combined);
172
+ return machineHash.substring(0, 6);
173
+ } catch (error) {
174
+ console.warn("[MoonUI Pro] Machine ID generation fallback:", error);
175
+ const fallback = `${screen.width}-${navigator.userAgent.length}-${navigator.language}`;
176
+ const fallbackHash = await this.sha256Hash(fallback);
177
+ return fallbackHash.substring(0, 6);
178
+ }
179
+ }
180
+ /**
181
+ * Generate canvas fingerprint
182
+ */
183
+ async generateCanvasFingerprint() {
184
+ try {
185
+ const canvas = document.createElement("canvas");
186
+ const ctx = canvas.getContext("2d");
187
+ if (!ctx)
188
+ return "no-canvas";
189
+ ctx.textBaseline = "top";
190
+ ctx.font = "14px Arial";
191
+ ctx.fillStyle = "#f60";
192
+ ctx.fillRect(125, 1, 62, 20);
193
+ ctx.fillStyle = "#069";
194
+ ctx.fillText("MoonUI Browser Fingerprint \u{1F510}", 2, 15);
195
+ ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
196
+ ctx.fillRect(45, 25, 80, 15);
197
+ const dataURL = canvas.toDataURL();
198
+ const hash = await this.sha256Hash(dataURL);
199
+ return hash.substring(0, 8);
200
+ } catch (error) {
201
+ return "canvas-error";
202
+ }
203
+ }
204
+ /**
205
+ * Generate WebGL fingerprint
206
+ */
207
+ generateWebGLFingerprint() {
208
+ try {
209
+ const canvas = document.createElement("canvas");
210
+ const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
211
+ if (!gl)
212
+ return "no-webgl";
213
+ const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
214
+ const vendor = debugInfo ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : "unknown";
215
+ const renderer = debugInfo ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : "unknown";
216
+ return `${vendor}-${renderer}`.replace(/\s+/g, "-").substring(0, 16);
217
+ } catch (error) {
218
+ return "webgl-error";
219
+ }
220
+ }
221
+ /**
222
+ * Generate audio context fingerprint
223
+ */
224
+ async generateAudioFingerprint() {
225
+ try {
226
+ const AudioContext = window.AudioContext || window.webkitAudioContext;
227
+ if (!AudioContext)
228
+ return "no-audio";
229
+ const context = new AudioContext();
230
+ const oscillator = context.createOscillator();
231
+ const gain = context.createGain();
232
+ oscillator.type = "triangle";
233
+ oscillator.frequency.setValueAtTime(1e3, context.currentTime);
234
+ gain.gain.setValueAtTime(0.01, context.currentTime);
235
+ oscillator.connect(gain);
236
+ gain.connect(context.destination);
237
+ const audioFingerprint = [
238
+ context.sampleRate.toString(),
239
+ context.destination.maxChannelCount.toString(),
240
+ context.destination.channelCount.toString(),
241
+ context.baseLatency ? context.baseLatency.toString() : "0",
242
+ context.outputLatency ? context.outputLatency.toString() : "0"
243
+ ].join("-");
244
+ try {
245
+ context.close();
246
+ } catch {
247
+ }
248
+ return audioFingerprint.substring(0, 8);
249
+ } catch (error) {
250
+ return "audio-error";
251
+ }
252
+ }
143
253
  /**
144
254
  * SHA256 hash function for consistency with CLI
145
255
  * Returns first 8 characters of SHA256 hex digest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.32.32",
3
+ "version": "2.32.33",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",