A robust, browser-based device UUID generator that creates unique fingerprints using multiple browser attributes including Canvas, WebGL, AudioContext, and LocalStorage estimates.
| Feature | Description |
|---|---|
| π‘οΈ Privacy-First | Generates a hash, never stores raw PII. Cookies are NOT used. |
| π΅οΈββοΈ Incognito-Proof | Stable Mode (default) ensures the same Device ID is generated in Normal and Incognito windows. |
| π High Entropy | Combines 8+ hardware/software signals (Canvas, WebGL, Audio, Storage, etc.) for high uniqueness. |
| π¦ Universal | Works everywhere: Browser (ESM/IIFE), Node.js, and Bundlers (Webpack/Vite). |
| π TypeScript | Written in TypeScript with full type definitions included. |
| Browser | Version | Status |
|---|---|---|
| Chrome | 60+ | β Supported |
| Firefox | 60+ | β Supported |
| Safari | 12+ | β Supported |
| Edge | 79+ | β Supported |
| iOS / Android | Modern | β Supported |
npm install @auralogiclabs/client-uuid-genimport { getFingerprint } from '@auralogiclabs/client-uuid-gen';
async function identifyDevice() {
try {
// Default: MD5 hash, Stable Mode enabled
const deviceId = await getFingerprint();
console.log('Device UUID (Stable):', deviceId);
// Option: SHA-256 hash (64 chars)
const deviceIdStrong = await getFingerprint({ algo: 'sha256' });
console.log('Device UUID (SHA-256):', deviceIdStrong);
} catch (error) {
console.error('Failed to generate fingerprint:', error);
}
}Browsers often intentionally alter fingerprinting data in Incognito/Private windows to prevent tracking (e.g., hiding real screen height, adding noise to audio signals).
This library handles this automatically.
true(Default): Treats Normal and Incognito windows as the SAME user.- How? It neutralizes unstable components (e.g., ignores screen height, skips audio fingerprinting) to ensure the hash remains consistent.
false: Treats Normal and Incognito windows as DIFFERENT users.- How? It uses all available data, which means the noise injected by the browser will cause the hash to change.
// Treat Incognito as a unique/different user (Strict Mode)
const strictId = await getFingerprint({
enableStableFingerprinting: false,
});
// Treat Incognito as the same user (Stable Mode - Default)
const stableId = await getFingerprint({
enableStableFingerprinting: true,
});You can access the EnhancedDeviceFingerprint class directly to inspect individual components.
import { EnhancedDeviceFingerprint } from '@auralogiclabs/client-uuid-gen';
async function fullAnalysis() {
const fingerprinter = new EnhancedDeviceFingerprint();
// 1. Generate the hash
const uuid = await fingerprinter.get();
console.log('UUID:', uuid);
// 2. Access internal components (populated after get/generateFingerprint)
console.log('Detailed Components:', fingerprinter.components);
/* Output example:
{
basic: { userAgent: "...", screenResolution: "1920x(Authored)", ... },
canvas: "data:image/png;base64,...",
webgl: "...",
audio: "audio-omitted-for-stability",
storage: "..."
}
*/
}For direct use in the browser without a bundler, use the global build.
<!-- Load crypto-js dependency (standard hashing support) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<!-- Load the library -->
<script src="https://unpkg.com/@auralogiclabs/client-uuid-gen/dist/index.global.js"></script>
<script>
const { getFingerprint } = window.ClientUUIDGen;
getFingerprint().then((uuid) => {
console.log('Generated UUID:', uuid);
});
</script>This library generates a "fingerprint" by collecting stable characteristics of the user's browser environment:
- Basic Info: User Agent, OS, Browser, Device Type, Language, Screen Resolution, Timezone.
- Canvas Fingerprinting: Renders a hidden canvas with specific text and colors. Differences in graphics hardware produce unique data URLs.
- WebGL Fingerprinting: Queries WebGL vendor and renderer information.
- Audio Fingerprinting: Uses an OfflineAudioContext to render a specific oscillator tone. Differences in audio hardware/drivers produce unique signal processing results.
- Storage Fingerprinting: Estimates available storage quota to bucket users (e.g., "fast device with lots of space" vs "budget device").
All these components are combined into a JSON string and hashed to produce a short, unique identifier.
Fingerprinting allows identification without cookies. Ensure you comply with GDPR, CCPA, and other privacy regulations.
- Inform users that device characteristics are being used for identification/fraud prevention.
- Obtain necessary consents if required in your jurisdiction.
- Node.js 18+
git clone https://github.com/auralogiclabs/client-uuid-gen.git
cd client-uuid-gen
npm installGenerates dist/ folder with CJS, ESM, and IIFE formats.
npm run buildRuns unit tests using Vitest.
npm testnpm run lint
npm run formatTo run the example page locally:
Important: Run the server from the project root, not inside the
examples/folder. This ensures the browser can correct access thedist/folder.
# 1. Build the library first
npm run build
# 2. Serve from project root
npx serve .
# 3. Visit http://localhost:3000/examples/| Example Output |
|---|
![]() |
MIT Β© Auralogic Labs
