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