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.

99 lines (98 loc) 4.6 kB
import { FontPreferencesInfo, MathInfo, PluginInfo, TouchSupportInfo, WebGLInfo, CanvasInfo } from './types'; /** * Get color gamut of the device * @returns Color gamut of the device (rec2020, p3, srgb, unknown) * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-gamut */ export declare function getColorGamut(): string; /** * Generates an audio fingerprint by analyzing the device's audio processing characteristics. * * @returns A numeric fingerprint representing the device's audio profile, or `null` if fingerprinting fails. */ export declare function getAudioFingerprint(): Promise<number | null>; /** * Detects and returns the browser vendor flavors present in the user agent string. * * @returns An array containing any combination of 'chrome', 'firefox', and 'safari' if detected in the current browser. */ export declare function getVendorFlavors(): string[]; /** * Determines whether `localStorage` is available and writable in the current environment. * * @returns `true` if `localStorage` can be used; otherwise, `false` */ export declare function isLocalStorageEnabled(): boolean; /** * Determines whether sessionStorage is available and writable in the current environment. * * @returns True if sessionStorage can be used; otherwise, false. */ export declare function isSessionStorageEnabled(): boolean; /** * Determines whether IndexedDB is available in the current environment. * * @returns `true` if `window.indexedDB` is present; otherwise, `false`. */ export declare function isIndexedDBEnabled(): boolean; /** * Asynchronously retrieves the device's WebGL vendor, renderer, and a SHA-256 hash of a rendered WebGL scene. * * @returns A Promise that resolves to an object containing the WebGL vendor, renderer, and an imageHash representing the rendered scene. If WebGL is unavailable or an error occurs, the imageHash will contain an error string. */ export declare function getWebGLInfo(): Promise<WebGLInfo>; /** * Generates a fingerprint of the device's canvas rendering capabilities. * * @returns An object containing the winding rule support, a data URL of the rendered canvas, and the font used. */ export declare function getCanvasFingerprint(): CanvasInfo; /** * Returns an array of plugin information objects detected from the browser's `navigator.plugins`. * * Each object includes the plugin's name, description, and an array of supported MIME types with their suffixes. * Returns an empty array if plugins are unavailable or an error occurs. * * @returns An array of plugin information objects, or an empty array if not available. */ export declare function getPluginsInfo(): PluginInfo[]; /** * Returns a fingerprint object containing the results of various Math functions applied to fixed input values. * * @returns An object with the results of `acos`, `acosh`, `asinh`, `atanh`, `expm1`, `sinh`, `cosh`, and `tanh` for specific numeric inputs. */ export declare function getMathFingerprint(): MathInfo; /** * Detects and returns a sorted list of fonts available on the user's system by comparing rendered text dimensions against generic font baselines. * * @returns An object containing the sorted array of detected font names under `detectedFonts`. */ export declare function getFontPreferences(): FontPreferencesInfo; /** * Returns information about the device's touch support capabilities. * * @returns An object containing the maximum number of touch points supported and boolean flags indicating the presence of touch event support. */ export declare function getTouchSupportInfo(): TouchSupportInfo; /** * Detects and returns the operating system name and version based on the browser's user agent and platform. * * @returns An object containing the detected OS name and version. */ export declare function getOSInfo(): { platform: string; os: string; version: string; } | { os: string; version: string; platform?: undefined; }; /** * Estimates the number of logical CPU cores available to the browser. * * Spawns multiple Web Workers to perform compute-intensive tasks and measures their execution times to infer the likely number of cores. Falls back to the browser-reported value or a capped estimate if workers are unavailable or if the test times out. The result is further limited for certain browsers to account for known reporting inconsistencies. * * @returns A promise that resolves to the estimated number of logical CPU cores, between 1 and 12 (or 8 for Firefox and some environments). */ export declare function estimateCores(): Promise<number>;