@zaplier/sdk 1.0.6 → 1.0.8

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.esm.js CHANGED
@@ -151,8 +151,12 @@ function x64hash128(input, seed = 0) {
151
151
  h1 = x64Add(h1, h2);
152
152
  h2 = x64Add(h2, h1);
153
153
  // Convert to hex string
154
- const hex1 = h1[0].toString(16).padStart(8, "0") + h1[1].toString(16).padStart(8, "0");
155
- const hex2 = h2[0].toString(16).padStart(8, "0") + h2[1].toString(16).padStart(8, "0");
154
+ // CRITICAL: Use >>> 0 to convert to unsigned 32-bit integer before converting to hex
155
+ // This prevents negative numbers from generating hashes with minus signs (e.g., "-6b43973f")
156
+ const hex1 = (h1[0] >>> 0).toString(16).padStart(8, "0") +
157
+ (h1[1] >>> 0).toString(16).padStart(8, "0");
158
+ const hex2 = (h2[0] >>> 0).toString(16).padStart(8, "0") +
159
+ (h2[1] >>> 0).toString(16).padStart(8, "0");
156
160
  return hex1 + hex2;
157
161
  }
158
162
  /**
@@ -5973,10 +5977,29 @@ async function collectFingerprint(options = {}) {
5973
5977
  // - Exact hardware values (use buckets)
5974
5978
  // Generate ultra-stable hash with additional collision resistance
5975
5979
  const stableCoreHash = hashStableCore(coreVector, opts.debug);
5976
- // CRITICAL: Generate enhanced fingerprint hash combining unstable + stable components
5977
- // This prevents collisions by adding stable entropy to the fingerprint hash
5980
+ // CRITICAL: Generate enhanced fingerprint hash combining STABLE components only
5981
+ // Filter out unstable components that change between requests (canvas, webgl, audio)
5982
+ // These components can vary due to GPU state, rendering context, permissions, etc.
5983
+ const unstableComponentKeys = [
5984
+ "canvas",
5985
+ "webgl",
5986
+ "audio", // Visual/audio fingerprints (vary with context)
5987
+ "mathFingerprint",
5988
+ "fontPreferences",
5989
+ "enhancedFonts", // Measurement-based (can timeout/vary)
5990
+ "dateTimeLocale",
5991
+ "accessibilityEnhanced", // Locale/accessibility (can change)
5992
+ "domBlockers",
5993
+ "pluginsEnhanced", // Privacy tools detection (can change)
5994
+ ];
5995
+ const stableComponentValues = {};
5996
+ for (const [key, value] of Object.entries(componentValues)) {
5997
+ if (!unstableComponentKeys.includes(key)) {
5998
+ stableComponentValues[key] = value;
5999
+ }
6000
+ }
5978
6001
  const enhancedComponentValues = {
5979
- ...componentValues, // Unstable components (canvas, webgl, audio, etc.)
6002
+ ...stableComponentValues, // STABLE components only (screen, browser, system, etc.)
5980
6003
  _stableCore: coreVector, // + Ultra-stable components (ua, platform, deviceType, etc.)
5981
6004
  // REMOVED: _hourlyEntropy - was causing visitor ID instability (same user = different IDs)
5982
6005
  };