@trillet-ai/web-sdk
Version:
Trillet Web SDK for real-time audio communication with AI agents
47 lines (46 loc) • 1.88 kB
TypeScript
/**
* Browser Fingerprinting Utility
* Generates a deterministic fingerprint based on stable browser/hardware characteristics.
* Used for demo link usage limit tracking.
*
* Strategy:
* 1. localStorage persistence — generate once, reuse across tabs/sessions forever
* 2. Stable hardware-only seed — if storage is cleared, the same hardware signals
* produce the same hash, so the fingerprint stays consistent
* 3. Server-side IP fallback — handled by the backend when no fingerprint is sent
*/
export declare class BrowserFingerprint {
private static cachedFingerprint;
/**
* Generate (or retrieve) a deterministic browser fingerprint.
* Cached in memory → localStorage → derived from stable hardware signals.
*/
static generate(): Promise<string>;
/**
* Collect only hardware / environment signals that do NOT change between
* tabs, sessions, or browser restarts on the same device.
*
* Deliberately excluded (volatile / anti-fingerprint randomised):
* - canvas.toDataURL() — randomised per origin in many browsers
* - font detection — noisy across rendering states
* - screen.availWidth/Height — changes with taskbar / dock resize
* - navigator.doNotTrack — user can toggle
* - timezoneOffset — changes with DST
* - navigator.userAgent — changes on browser update
*/
private static getStableSignals;
/**
* WebGL vendor + renderer string (GPU identifier, very stable)
*/
private static getWebGLFingerprint;
/**
* SHA-256 hash of the signals object → hex string
*/
private static hashComponents;
private static getStored;
private static persist;
/**
* Clear both in-memory and persisted fingerprint (useful for testing)
*/
static clearCache(): void;
}