UNPKG

fingerprint-oss

Version:

A comprehensive JavaScript library for device fingerprinting and system information collection. Provides robust, deterministic fingerprinting for web applications with privacy-conscious design.

116 lines (115 loc) 5.14 kB
/*! * Copyright (c) 2025 Akshat Kotpalliwar (alias IntegerAlex on GitHub) * This software is licensed under the GNU Lesser General Public License (LGPL) v3 or later. * * You are free to use, modify, and redistribute this software, but modifications must also be licensed under the LGPL. * This project is distributed without any warranty; see the LGPL for more details. * * For a full copy of the LGPL and ethical contribution guidelines, please refer to the `COPYRIGHT.md` and `NOTICE.md` files. */ import { generateJSON } from './json'; import { fetchGeolocationInfo } from './geo-ip'; import { getSystemInfo, detectBot } from './systemInfo'; import { getMockSystemInfo } from './mock'; import { isRiskyASN, getUAPlatformMismatch, getLanguageConsistency, checkBrowserConsistency } from './confidence'; import { Toast } from './compliance'; import { generateId } from './hash'; import { detectIncognito } from './incognito'; import { detectAdBlockers } from './adblocker'; import { getVpnStatus } from './vpn'; import { getColorGamut, getVendorFlavors, isLocalStorageEnabled, isSessionStorageEnabled, isIndexedDBEnabled, getTouchSupportInfo, getOSInfo, getPluginsInfo, getMathFingerprint, getCanvasFingerprint, getAudioFingerprint, getWebGLInfo, getFontPreferences, estimateCores } from './helper'; /** * Retrieves user system and geolocation data concurrently, computes a confidence score, and returns a JSON object summarizing these details. * * The function fetches system and geolocation information in parallel and calculates a confidence score based on the integrity of the data. When the optional `transparency` flag is enabled, it logs a copyright notice and displays a notification via Toast using a custom message (or a default message if none is provided). If an error occurs during data retrieval, the function logs the error and uses fallback system data to compute the confidence score. * * @param config - Optional configuration with: * - `transparency`: When true, enables logging and Toast notifications for data collection transparency. * - `message`: A custom message to log and display; defaults to "the software is gathering system data" if not specified. * @returns A JSON object containing the fetched system and geolocation data (when available) along with the computed confidence score. */ declare function userInfo(config?: { transparency?: boolean; message?: string; }): Promise<{ confidenceAssessment: { combined?: { factors: string; rating: string; description: string; reliability: string; level: "low" | "medium-low" | "medium" | "medium-high" | "high"; score: number; } | undefined; system: { factors: string; rating: string; description: string; reliability: string; level: "low" | "medium-low" | "medium" | "medium-high" | "high"; score: number; }; }; geolocation: { vpnStatus: Object | undefined; ip: string; city: string; region: { isoCode: string; name: string; }; country: { isoCode: string; name: string; }; continent: { code: string; name: string; }; location: { accuracyRadius: number; latitude: number; longitude: number; timeZone: string; }; traits: { isAnonymous: boolean; isAnonymousProxy: boolean; isAnonymousVpn: boolean; network: string; }; } | null; systemInfo: import("./types").SystemInfo; hash: string; }>; declare const fingerprintOSS: typeof userInfo & { getSystemInfo: typeof getSystemInfo; detectBot: typeof detectBot; fetchGeolocationInfo: typeof fetchGeolocationInfo; generateJSON: typeof generateJSON; generateId: typeof generateId; detectIncognito: typeof detectIncognito; detectAdBlockers: typeof detectAdBlockers; getVpnStatus: typeof getVpnStatus; getColorGamut: typeof getColorGamut; getVendorFlavors: typeof getVendorFlavors; isLocalStorageEnabled: typeof isLocalStorageEnabled; isSessionStorageEnabled: typeof isSessionStorageEnabled; isIndexedDBEnabled: typeof isIndexedDBEnabled; getTouchSupportInfo: typeof getTouchSupportInfo; getOSInfo: typeof getOSInfo; getPluginsInfo: typeof getPluginsInfo; getMathFingerprint: typeof getMathFingerprint; getCanvasFingerprint: typeof getCanvasFingerprint; getAudioFingerprint: typeof getAudioFingerprint; getWebGLInfo: typeof getWebGLInfo; getFontPreferences: typeof getFontPreferences; estimateCores: typeof estimateCores; getLanguageConsistency: typeof getLanguageConsistency; isRiskyASN: typeof isRiskyASN; getUAPlatformMismatch: typeof getUAPlatformMismatch; checkBrowserConsistency: typeof checkBrowserConsistency; getMockSystemInfo: typeof getMockSystemInfo; Toast: typeof Toast; }; export default fingerprintOSS;