@moontra/moonui-pro 2.32.33 → 2.32.34
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.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +74 -41
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -100,42 +100,27 @@ var init_cli_token_reader = __esm({
|
|
|
100
100
|
return this.instance;
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
|
-
* Generate device fingerprint
|
|
104
|
-
* Format: platform-hostname-username_hash-
|
|
103
|
+
* Generate secure device fingerprint using hybrid approach
|
|
104
|
+
* Format: platform-hostname-username_hash-browser_machine_id
|
|
105
|
+
*
|
|
106
|
+
* SECURITY: Even if .env.local is copied, browser machine ID will be different
|
|
105
107
|
*/
|
|
106
108
|
async getDeviceFingerprint() {
|
|
107
109
|
try {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
111
|
-
if (userAgent.includes("mac") || userAgent.includes("darwin")) {
|
|
112
|
-
platform2 = "darwin";
|
|
113
|
-
} else if (userAgent.includes("win") || userAgent.includes("windows")) {
|
|
114
|
-
platform2 = "win32";
|
|
115
|
-
} else if (userAgent.includes("linux") || userAgent.includes("x11")) {
|
|
116
|
-
platform2 = "linux";
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
let hostname = process.env.NEXT_PUBLIC_MOONUI_HOSTNAME || "localhost";
|
|
120
|
-
if (typeof window !== "undefined" && !process.env.NEXT_PUBLIC_MOONUI_HOSTNAME) {
|
|
121
|
-
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1") {
|
|
122
|
-
hostname = window.location.hostname;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
110
|
+
const platform2 = this.detectBrowserPlatform();
|
|
111
|
+
const hostname = process.env.NEXT_PUBLIC_MOONUI_HOSTNAME || "localhost";
|
|
125
112
|
const username = process.env.NEXT_PUBLIC_MOONUI_USERNAME || "dev-user";
|
|
126
113
|
const usernameHash = await this.sha256Hash(username);
|
|
127
|
-
const
|
|
128
|
-
const fingerprint = `${platform2}-${hostname}-${usernameHash}-${
|
|
129
|
-
console.log("[MoonUI Pro]
|
|
114
|
+
const browserMachineId = await this.generateBrowserMachineId();
|
|
115
|
+
const fingerprint = `${platform2}-${hostname}-${usernameHash}-${browserMachineId}`;
|
|
116
|
+
console.log("[MoonUI Pro] Secure browser device fingerprint generated:", {
|
|
130
117
|
platform: platform2,
|
|
131
118
|
hostname,
|
|
132
119
|
username: username.substring(0, 3) + "***",
|
|
133
|
-
// Partial logging for privacy
|
|
134
120
|
usernameHash,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
// Partial logging for privacy
|
|
121
|
+
browserMachineId: browserMachineId.substring(0, 4) + "***",
|
|
122
|
+
fingerprint: fingerprint.substring(0, 25) + "***",
|
|
123
|
+
security: "browser-machine-locked"
|
|
139
124
|
});
|
|
140
125
|
return fingerprint;
|
|
141
126
|
} catch (error) {
|
|
@@ -143,6 +128,22 @@ var init_cli_token_reader = __esm({
|
|
|
143
128
|
return "browser-fallback-device";
|
|
144
129
|
}
|
|
145
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Detect platform in browser environment (CLI compatible)
|
|
133
|
+
*/
|
|
134
|
+
detectBrowserPlatform() {
|
|
135
|
+
if (typeof window === "undefined")
|
|
136
|
+
return "unknown";
|
|
137
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
138
|
+
if (userAgent.includes("mac") || userAgent.includes("darwin")) {
|
|
139
|
+
return "darwin";
|
|
140
|
+
} else if (userAgent.includes("win") || userAgent.includes("windows")) {
|
|
141
|
+
return "win32";
|
|
142
|
+
} else if (userAgent.includes("linux") || userAgent.includes("x11")) {
|
|
143
|
+
return "linux";
|
|
144
|
+
}
|
|
145
|
+
return "unknown";
|
|
146
|
+
}
|
|
146
147
|
/**
|
|
147
148
|
* Generate browser-specific machine ID using multiple browser characteristics
|
|
148
149
|
* This prevents token sharing between different browsers/machines
|
|
@@ -250,6 +251,32 @@ var init_cli_token_reader = __esm({
|
|
|
250
251
|
return "audio-error";
|
|
251
252
|
}
|
|
252
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Validate device compatibility (CLI vs Browser)
|
|
256
|
+
* CLI: platform-hostname-userHash-macHash
|
|
257
|
+
* Browser: platform-hostname-userHash-browserHash
|
|
258
|
+
* Compatible if first 3 parts match
|
|
259
|
+
*/
|
|
260
|
+
validateDeviceCompatibility(tokenDeviceId, currentDeviceId) {
|
|
261
|
+
const tokenParts = tokenDeviceId.split("-");
|
|
262
|
+
const currentParts = currentDeviceId.split("-");
|
|
263
|
+
if (tokenParts.length < 3 || currentParts.length < 3) {
|
|
264
|
+
return { compatible: false, reason: "Invalid device ID format" };
|
|
265
|
+
}
|
|
266
|
+
const platformMatch = tokenParts[0] === currentParts[0];
|
|
267
|
+
const hostnameMatch = tokenParts[1] === currentParts[1];
|
|
268
|
+
const userHashMatch = tokenParts[2] === currentParts[2];
|
|
269
|
+
if (!platformMatch) {
|
|
270
|
+
return { compatible: false, reason: "Platform mismatch (different OS)" };
|
|
271
|
+
}
|
|
272
|
+
if (!hostnameMatch) {
|
|
273
|
+
return { compatible: false, reason: "Hostname mismatch (different machine)" };
|
|
274
|
+
}
|
|
275
|
+
if (!userHashMatch) {
|
|
276
|
+
return { compatible: false, reason: "User account mismatch" };
|
|
277
|
+
}
|
|
278
|
+
return { compatible: true };
|
|
279
|
+
}
|
|
253
280
|
/**
|
|
254
281
|
* SHA256 hash function for consistency with CLI
|
|
255
282
|
* Returns first 8 characters of SHA256 hex digest
|
|
@@ -342,21 +369,27 @@ var init_cli_token_reader = __esm({
|
|
|
342
369
|
}
|
|
343
370
|
const currentDeviceId = await this.getDeviceFingerprint();
|
|
344
371
|
const tokenDeviceId = tokenData.deviceId;
|
|
345
|
-
console.log("[MoonUI Pro]
|
|
346
|
-
currentDevice: currentDeviceId,
|
|
347
|
-
tokenDevice: tokenDeviceId,
|
|
348
|
-
matches: currentDeviceId === tokenDeviceId
|
|
372
|
+
console.log("[MoonUI Pro] Hybrid device compatibility check:", {
|
|
373
|
+
currentDevice: currentDeviceId.substring(0, 25) + "***",
|
|
374
|
+
tokenDevice: tokenDeviceId.substring(0, 25) + "***"
|
|
349
375
|
});
|
|
350
|
-
if (tokenDeviceId
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
376
|
+
if (tokenDeviceId) {
|
|
377
|
+
const compatibility = this.validateDeviceCompatibility(tokenDeviceId, currentDeviceId);
|
|
378
|
+
if (!compatibility.compatible) {
|
|
379
|
+
console.error("[MoonUI Pro] Device compatibility check failed!");
|
|
380
|
+
console.error("[MoonUI Pro] Reason:", compatibility.reason);
|
|
381
|
+
console.error("[MoonUI Pro] This indicates:");
|
|
382
|
+
console.log(" \u2022 Token was created on a different machine or user account");
|
|
383
|
+
console.log(" \u2022 .env.local file may have been copied from another device");
|
|
384
|
+
console.log(" \u2022 Different hostname or user profile detected");
|
|
385
|
+
console.log("[MoonUI Pro] Solutions:");
|
|
386
|
+
console.log(' \u2022 Run "moonui login" on this device to create a new session');
|
|
387
|
+
console.log(" \u2022 Ensure you are using the correct user account");
|
|
388
|
+
console.log(" \u2022 Verify hostname matches the original login device");
|
|
389
|
+
console.log(" \u2022 Contact support for multi-device licensing options");
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
console.log("[MoonUI Pro] Device compatibility validated successfully");
|
|
360
393
|
}
|
|
361
394
|
const isValid2 = await this.validateWithAPI(tokenData.token, tokenDeviceId || currentDeviceId);
|
|
362
395
|
if (!isValid2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.34",
|
|
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",
|