/** * Configuration options for DeviceUUID */ interface DeviceUUIDOptions { version?: boolean; language?: boolean; platform?: boolean; os?: boolean; pixelDepth?: boolean; colorDepth?: boolean; resolution?: boolean; isAuthoritative?: boolean; silkAccelerated?: boolean; isKindleFire?: boolean; isDesktop?: boolean; isMobile?: boolean; isTablet?: boolean; isWindows?: boolean; isLinux?: boolean; isLinux64?: boolean; isChromeOS?: boolean; isMac?: boolean; isiPad?: boolean; isiPhone?: boolean; isiPod?: boolean; isAndroid?: boolean; isSamsung?: boolean; isSmartTV?: boolean; isRaspberry?: boolean; isBlackberry?: boolean; isTouchScreen?: boolean; isOpera?: boolean; isIE?: boolean; isEdge?: boolean; isIECompatibilityMode?: boolean; isSafari?: boolean; isFirefox?: boolean; isWebkit?: boolean; isChrome?: boolean; isKonqueror?: boolean; isOmniWeb?: boolean; isSeaMonkey?: boolean; isFlock?: boolean; isAmaya?: boolean; isPhantomJS?: boolean; isEpiphany?: boolean; source?: boolean; cpuCores?: boolean; } /** * Device and browser information */ interface AgentInfo { isMobile: boolean; isDesktop: boolean; isTablet: boolean; isBot: boolean | string; isSmartTV: boolean | string; isTouchScreen: boolean; isiPad: boolean; isiPod: boolean; isiPhone: boolean; isAndroid: boolean; isBlackberry: boolean; isSamsung: boolean; isRaspberry: boolean; isAndroidTablet: boolean; isWindowsPhone?: boolean; isOpera: boolean; isIE: boolean; isEdge: boolean; isIECompatibilityMode: boolean; isSafari: boolean; isFirefox: boolean; isWebkit: boolean; isChrome: boolean; isKonqueror: boolean; isOmniWeb: boolean; isSeaMonkey: boolean; isFlock: boolean; isAmaya: boolean; isPhantomJS: boolean; isEpiphany: boolean; isWinJs: boolean; isUC: boolean; isWindows: boolean; isLinux: boolean; isLinux64: boolean; isMac: boolean; isChromeOS: boolean; isBada: boolean; isKindleFire: boolean; isSilk: boolean; silkAccelerated: boolean; isCaptive: boolean; isCurl: boolean; isAuthoritative: boolean; colorDepth: number; pixelDepth: number; resolution: [number, number]; cpuCores: number; language: string; browser: string; version: string; os: string; platform: string; geoIp: Record; source: string; hashInt: (str: string) => number; hashMD5: (str: string) => string; } /** * Regex patterns for browser detection */ interface BrowserPatterns { [key: string]: RegExp; } /** * Regex patterns for version detection */ interface VersionPatterns { [key: string]: RegExp; } /** * Regex patterns for OS detection */ interface OSPatterns { [key: string]: RegExp; } /** * Regex patterns for platform detection */ interface PlatformPatterns { [key: string]: RegExp; } /** * Supported fingerprinting features */ type FingerprintFeature = 'canvas' | 'webgl' | 'audio' | 'fonts' | 'mediaDevices' | 'networkInfo' | 'timezone' | 'incognitoDetection'; /** * Extended options for async fingerprint generation * All advanced fingerprinting methods are opt-in (disabled by default) for privacy */ interface FingerprintOptions { /** Enable Canvas fingerprinting (default: false) */ canvas?: boolean; /** Enable WebGL fingerprinting (default: false) */ webgl?: boolean; /** Enable AudioContext fingerprinting (default: false) */ audio?: boolean; /** Enable font detection - boolean or custom font list (default: false) */ fonts?: boolean | string[]; /** Enable media devices enumeration (default: false) */ mediaDevices?: boolean; /** Enable network information collection (default: false) */ networkInfo?: boolean; /** Enable timezone collection (default: false) */ timezone?: boolean; /** Enable incognito/private mode detection (default: false) */ incognitoDetection?: boolean; /** Global timeout in milliseconds (default: 5000) */ timeout?: number; /** Per-method timeout in milliseconds (default: 1000) */ methodTimeout?: number; /** Preset name to use as base configuration (optional) */ preset?: FingerprintPreset; } /** * Individual fingerprint component result */ interface FingerprintComponent { /** Component name */ name: string; /** Hash value or null if unavailable */ value: string | null; /** Whether collection succeeded */ success: boolean; /** Error message if collection failed */ error?: string; /** Time taken to collect in milliseconds */ duration?: number; } /** * Detailed fingerprint result with all components */ interface FingerprintDetails { /** Final combined UUID */ uuid: string; /** Individual component results */ components: { basic: FingerprintComponent; canvas?: FingerprintComponent; webgl?: FingerprintComponent; audio?: FingerprintComponent; fonts?: FingerprintComponent; mediaDevices?: FingerprintComponent; networkInfo?: FingerprintComponent; timezone?: FingerprintComponent; incognito?: FingerprintComponent; }; /** Confidence score (0-1) based on available data points */ confidence: number; /** Total fingerprinting duration in milliseconds */ duration: number; /** Timestamp when fingerprint was generated */ timestamp: number; } /** * Preset configuration names for fingerprint options */ type FingerprintPreset = 'minimal' | 'standard' | 'comprehensive'; /** * DeviceUUID - Fast browser device UUID generation * Analyzes user agent and device characteristics to generate unique identifiers */ /** * DeviceUUID Class * Main class for device detection and UUID generation */ declare class DeviceUUID { private readonly options; private readonly versionPatterns; private readonly browserPatterns; private readonly osPatterns; private readonly platformPatterns; private agent; /** * Get or set the user agent string */ get userAgent(): string; set userAgent(value: string); /** * Create a new DeviceUUID instance * @param options - Configuration options */ constructor(options?: Partial); /** * Get browser name from user agent string */ private getBrowser; /** * Get browser version from user agent string */ private getBrowserVersion; /** * Read a decimal integer at a known offset without applying an unbounded regex * to the whole user-agent string. */ private readLeadingInteger; private getWindows11BrowserMajorVersion; private hasIOSDeviceOS; /** * Get operating system from user agent string */ private getOS; /** * Get platform from user agent string */ private getPlatform; /** * Test for bot/crawler */ private testBot; /** * Test for Smart TV */ private testSmartTV; /** * Test for mobile device */ private testMobile; /** * Test for Android tablet */ private testAndroidTablet; /** * Test for tablet device */ private testTablet; /** * Test for IE compatibility mode */ private testCompatibilityMode; /** * Test for Amazon Silk browser */ private testSilk; /** * Test for Kindle Fire device */ private testKindleFire; /** * Test for Captive Network Assistant */ private testCaptiveNetwork; /** * Test for touch screen support */ private testTouchSupport; /** * Get language from browser */ private getLanguageInfo; /** * Get color depth */ private getColorDepthInfo; /** * Get pixel depth */ private getPixelDepthInfo; /** * Get screen resolution */ private getScreenResolutionInfo; /** * Get CPU core count */ private getCPUInfo; /** * Reset agent to default state */ reset(): this; /** * Parse user agent and collect device information * @param source - User agent string (defaults to navigator.userAgent) * @returns AgentInfo object with device details */ parse(source?: string): AgentInfo; /** * Generate a UUID based on device characteristics * @param customData - Optional custom data to include in UUID generation * @returns UUID string in v4 format */ get(customData?: string): string; /** * Generate a UUID asynchronously with advanced fingerprinting methods * @param options - Fingerprint options or preset name * @returns Promise resolving to UUID string */ getAsync(options?: Partial | FingerprintPreset): Promise; /** * Generate detailed fingerprint with all component information * @param options - Fingerprint options or preset name * @returns Promise resolving to detailed fingerprint result */ getDetailedAsync(options?: Partial | FingerprintPreset): Promise; /** * Get individual fingerprint components (synchronous basic components only) * @returns Object with component hashes */ getComponents(): Record; /** * Check if a fingerprinting feature is supported * @param feature - Feature to check * @returns Whether the feature is supported */ static isFeatureSupported(feature: FingerprintFeature): boolean; /** * Get media devices fingerprint hash * @returns Promise resolving to hash or null */ private getMediaDevicesHash; /** * Get network information fingerprint hash * @returns Hash or null */ private getNetworkInfoHash; /** * Get timezone fingerprint hash * @returns Hash or null */ private getTimezoneHash; /** * Detect incognito/private browsing mode * @returns Promise resolving to hash or null */ private detectIncognito; } /** * List of known bot user agents */ declare const BOTS: readonly string[]; /** * Browser version detection patterns */ declare const VERSION_PATTERNS: Readonly; /** * Browser detection patterns */ declare const BROWSER_PATTERNS: Readonly; /** * Operating system detection patterns */ declare const OS_PATTERNS: Readonly; /** * Platform detection patterns */ declare const PLATFORM_PATTERNS: Readonly; /** * Default configuration options */ declare const DEFAULT_OPTIONS: Readonly; /** * MD5 Hash Implementation * Pure JavaScript MD5 implementation for browser and Node.js compatibility */ /** * Calculate MD5 hash of a string * @param str - Input string to hash * @returns MD5 hash as lowercase hexadecimal string */ declare const hashMD5: (str: string) => string; /** * Calculate a simple integer hash of a string * @param str - Input string to hash * @returns Integer hash value */ declare const hashInt: (str: string) => number; /** * Fingerprint utility functions * Common operations for hash combining, error handling, and feature detection */ /** * Default fingerprint options - all advanced methods disabled for privacy */ declare const DEFAULT_FINGERPRINT_OPTIONS: Readonly; /** * Fingerprint option presets */ declare const FINGERPRINT_PRESETS: Readonly>; /** * Merge fingerprint options with defaults * @param options - Partial options to merge * @returns Complete options object */ declare const mergeOptions: (options?: Partial) => FingerprintOptions; /** * Get preset options by name * @param preset - Preset name * @returns Fingerprint options for the preset */ declare const getPresetOptions: (preset: FingerprintPreset) => FingerprintOptions; /** * Check if a specific fingerprinting feature is supported in the current environment * @param feature - Feature to check * @returns Whether the feature is supported */ declare const isFeatureSupported: (feature: FingerprintFeature) => boolean; /** * Error log entry */ interface ErrorLogEntry { /** Component that caused the error */ component: string; /** Error message */ error: string; /** Timestamp when error occurred */ timestamp: number; } /** * Error logger configuration */ interface ErrorLoggerConfig { /** Whether logging is enabled */ enabled?: boolean; /** Maximum number of errors to store */ maxErrors?: number; /** Custom callback for errors */ onError?: (entry: ErrorLogEntry) => void; } /** * Error logger class for centralized error handling */ declare class ErrorLogger { private errors; private config; constructor(config?: ErrorLoggerConfig); /** * Log an error * @param component - Component that caused the error * @param error - Error object or message */ log(component: string, error: unknown): void; /** * Get all logged errors * @returns Array of error entries */ getErrors(): readonly ErrorLogEntry[]; /** * Clear all logged errors */ clear(): void; /** * Enable or disable logging * @param enabled - Whether to enable logging */ setEnabled(enabled: boolean): void; /** * Check if logging is enabled * @returns Whether logging is enabled */ isEnabled(): boolean; } /** * Get or create the global error logger * @param config - Optional configuration * @returns Error logger instance */ declare const getErrorLogger: (config?: ErrorLoggerConfig) => ErrorLogger; /** * Log an error to the global error logger * @param component - Component that caused the error * @param error - Error object or message */ declare const logError: (component: string, error: unknown) => void; /** * Canvas Fingerprinting Module * Generates unique fingerprint based on canvas rendering differences */ /** * Canvas fingerprint options */ interface CanvasFingerprintOptions { /** Timeout in milliseconds */ timeout?: number; } /** * Generate canvas fingerprint * @param options - Fingerprint options * @returns Promise resolving to fingerprint hash or null */ declare const getCanvasFingerprint: (options?: CanvasFingerprintOptions) => Promise; /** * Check if Canvas 2D is supported * @returns Whether Canvas 2D is available */ declare const isCanvasSupported: () => boolean; /** * WebGL Fingerprinting Module * Generates unique fingerprint based on WebGL parameters and GPU info */ /** * WebGL fingerprint options */ interface WebGLFingerprintOptions { /** Timeout in milliseconds */ timeout?: number; } /** * Generate WebGL fingerprint * @param options - Fingerprint options * @returns Promise resolving to fingerprint hash or null */ declare const getWebGLFingerprint: (options?: WebGLFingerprintOptions) => Promise; /** * Check if WebGL is supported * @returns Whether WebGL is available */ declare const isWebGLSupported: () => boolean; /** * Check if WebGL debug info extension is available * @returns Whether WEBGL_debug_renderer_info is accessible */ declare const isDebugInfoSupported: () => boolean; /** * AudioContext Fingerprinting Module * Generates unique fingerprint based on audio processing differences */ /** * Audio fingerprint options */ interface AudioFingerprintOptions { /** Timeout in milliseconds */ timeout?: number; } /** * Generate audio fingerprint * @param options - Fingerprint options * @returns Promise resolving to fingerprint hash or null */ declare const getAudioFingerprint: (options?: AudioFingerprintOptions) => Promise; /** * Check if AudioContext is supported * @returns Whether AudioContext is available */ declare const isAudioSupported: () => boolean; /** * Check if OfflineAudioContext is supported * @returns Whether OfflineAudioContext is available */ declare const isOfflineAudioSupported: () => boolean; /** * Font Detection Fingerprinting Module * Generates unique fingerprint based on installed fonts */ /** * Font fingerprint options */ interface FontFingerprintOptions { /** Timeout in milliseconds */ timeout?: number; /** Custom list of fonts to check (overrides default) */ fonts?: string[]; } /** * Generate font fingerprint * @param options - Fingerprint options * @returns Promise resolving to fingerprint hash or null */ declare const getFontFingerprint: (options?: FontFingerprintOptions) => Promise; /** * Get list of detected fonts (for debugging/info) * @param fonts - List of fonts to check * @returns Array of detected font names */ declare const getDetectedFonts: (fonts?: string[]) => string[]; /** * Get default font list * @returns Default font list */ declare const getDefaultFontList: () => string[]; /** * Check if font detection is supported * @returns Whether font detection is available */ declare const isFontDetectionSupported: () => boolean; /** * Font detection cache options */ interface FontCacheOptions { /** Cache key in session storage */ cacheKey?: string; /** Whether to use cached results */ useCache?: boolean; /** Chunk size for async processing */ chunkSize?: number; /** Delay between chunks in ms */ chunkDelay?: number; /** Timeout for font detection in ms */ timeout?: number; } /** * Detect fonts using async/chunked processing to avoid blocking main thread * @param fonts - List of fonts to check * @param options - Chunking options * @returns Promise resolving to array of detected font names */ declare const getDetectedFontsAsync: (fonts?: readonly string[] | string[], options?: FontCacheOptions) => Promise; /** * Generate font fingerprint with async/chunked processing * @param options - Fingerprint options including caching * @returns Promise resolving to fingerprint hash or null */ declare const getFontFingerprintAsync: (options?: FontFingerprintOptions & FontCacheOptions) => Promise; export { type AgentInfo, BOTS, BROWSER_PATTERNS, DEFAULT_FINGERPRINT_OPTIONS, DEFAULT_OPTIONS, DeviceUUID, type DeviceUUIDOptions, type ErrorLogEntry, type ErrorLoggerConfig, FINGERPRINT_PRESETS, type FingerprintComponent, type FingerprintDetails, type FingerprintFeature, type FingerprintOptions, type FingerprintPreset, OS_PATTERNS, PLATFORM_PATTERNS, VERSION_PATTERNS, DeviceUUID as default, getAudioFingerprint, getCanvasFingerprint, getDefaultFontList, getDetectedFonts, getDetectedFontsAsync, getErrorLogger, getFontFingerprint, getFontFingerprintAsync, getPresetOptions, getWebGLFingerprint, hashInt, hashMD5, isAudioSupported, isCanvasSupported, isDebugInfoSupported, isFeatureSupported, isFontDetectionSupported, isOfflineAudioSupported, isWebGLSupported, logError, mergeOptions };