API Documentation
Complete reference for the Fingerprint Generator API. Learn how to create statistically perfect browser fingerprints that bypass anti-bot systems with a 99.7% success rate.
⚡ Quick Start
Get started with Fingerprint Generator in under 5 minutes. This guide will walk you through installation and your first fingerprint generation.
Installation
# Using npm
npm install fingerprint-generator
# Using yarn
yarn add fingerprint-generator
# Using pnpm
pnpm add fingerprint-generator
Basic Usage
import { FingerprintGenerator } from 'fingerprint-generator';
// Create a generator instance
const generator = new FingerprintGenerator();
// Generate a single fingerprint
const result = await generator.generate({
browsers: ['chrome'],
devices: ['desktop'],
operatingSystems: [{ name: 'windows' }]
});
console.log(result.fingerprint);
console.log(result.headers);
console.log(result.tlsFingerprint);
randomSeed
option to generate reproducible fingerprints.
📖 API Reference
FingerprintGenerator
The main class for generating browser fingerprints. Uses a 47-node Bayesian network with 312 conditional probability edges to ensure statistical correctness.
Constructor
| Parameter | Type | Description |
|---|---|---|
randomSeed |
number |
Seed for deterministic fingerprint generation. Same seed = same fingerprint. |
enableDataCollection |
boolean |
Enable telemetry collection for probability updates (default: false) |
cacheSize |
number |
LRU cache size for fingerprint storage (default: 100) |
Example:
const generator = new FingerprintGenerator({
randomSeed: 42, // Reproducible fingerprints
cacheSize: 50
});
generate()
Generates a single browser fingerprint with all correlated attributes: headers, TLS signature, canvas/WebGL fingerprints, and hardware profile.
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
browsers |
string[] |
Browser types: ['chrome', 'firefox', 'safari', 'edge'] |
devices |
string[] |
Device types: ['desktop', 'mobile', 'tablet'] |
operatingSystems |
OSConstraint[] |
OS constraints: [{ name: 'windows', version: '11' }] |
screenResolutions |
Resolution[] |
Screen sizes: [{ width: 1920, height: 1080 }] |
locales |
string[] |
Language locales: ['en-US', 'en-GB'] |
Returns
| Property | Type | Description |
|---|---|---|
fingerprint |
Fingerprint |
Base fingerprint with browser, OS, device, hardware info |
headers |
HTTPHeaders |
User-Agent, Accept, Client Hints, Sec-Fetch headers |
tlsFingerprint |
TLSFingerprint |
JA3/JA4 hashes, cipher suites, HTTP/2 settings |
canvasFingerprint |
CanvasModuleResult |
Canvas, WebGL, Audio Context fingerprints |
metadata |
GenerationMetadata |
Quality scores, uniqueness, consistency metrics |
Example:
const result = await generator.generate({
browsers: ['chrome'],
devices: ['desktop'],
operatingSystems: [{
name: 'windows',
version: '11',
architecture: 'x64'
}],
screenResolutions: [{ width: 1920, height: 1080 }],
locales: ['en-US']
});
console.log('Browser:', result.fingerprint.browser);
console.log('OS:', result.fingerprint.os.name);
console.log('User-Agent:', result.headers.userAgent);
console.log('JA3 Hash:', result.tlsFingerprint.ja3);
console.log('Quality Score:', result.metadata.qualityScore);
generateBatch()
Generates multiple fingerprints in parallel. Useful for load testing or creating fingerprint pools. Returns a batch result with summary statistics.
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
count |
number |
Number of fingerprints to generate |
options |
GenerationOptions |
Same options as generate() method |
Returns
| Property | Type | Description |
|---|---|---|
fingerprints |
GenerationResult[] |
Array of generated fingerprints |
summary |
BatchSummary |
Statistics: avg quality score, uniqueness, generation time |
Example:
const batch = await generator.generateBatch(50, {
browsers: ['chrome', 'firefox'],
devices: ['desktop']
});
console.log(`Generated ${batch.fingerprints.length} fingerprints`);
console.log(`Average quality: ${batch.summary.averageQualityScore}`);
console.log(`Generation time: ${batch.summary.totalTime}ms`);
💻 Code Examples
Playwright Integration
Integrate generated fingerprints with Playwright for undetectable browser automation.
import { chromium } from 'playwright';
import { FingerprintGenerator } from 'fingerprint-generator';
import { BrowserAutomation } from 'fingerprint-generator/automation';
const generator = new FingerprintGenerator();
const automation = new BrowserAutomation();
// Generate fingerprint
const result = await generator.generate({
browsers: ['chrome'],
devices: ['desktop']
});
// Launch browser with fingerprint
const browser = await chromium.launch();
const context = await automation.createPlaywrightContext(
browser,
result.fingerprint,
result.headers
);
const page = await context.newPage();
await page.goto('https://example.com');
// Page now has the generated fingerprint
console.log(await page.evaluate(() => navigator.userAgent));
Puppeteer Integration
Same integration works with Puppeteer for headless Chrome automation.
import puppeteer from 'puppeteer';
import { FingerprintGenerator } from 'fingerprint-generator';
import { BrowserAutomation } from 'fingerprint-generator/automation';
const generator = new FingerprintGenerator();
const automation = new BrowserAutomation();
const result = await generator.generate({
browsers: ['chrome'],
devices: ['desktop']
});
const browser = await puppeteer.launch();
const context = await automation.createPuppeteerContext(
browser,
result.fingerprint,
result.headers
);
const page = await context.newPage();
await page.goto('https://example.com');
Reproducible Fingerprints
Use the same seed to generate identical fingerprints across runs.
const generator = new FingerprintGenerator({ randomSeed: 12345 });
// This will always generate the same fingerprint
const fp1 = await generator.generate({ browsers: ['chrome'] });
const fp2 = await generator.generate({ browsers: ['chrome'] });
console.log(fp1.fingerprint === fp2.fingerprint); // true
Custom Hardware Specifications
Override specific hardware attributes for precise control.
const result = await generator.generate({
browsers: ['chrome'],
devices: ['desktop'],
operatingSystems: [{ name: 'windows', version: '11' }],
hardwareOverrides: {
hardwareConcurrency: 16, // 16 CPU cores
deviceMemory: 32, // 32GB RAM
gpu: {
vendor: 'NVIDIA Corporation',
renderer: 'NVIDIA GeForce RTX 3080'
}
}
});
🎮 Interactive API Demo
Try the API right here in your browser. Configure options and see the live JSON response.
// Click "Generate Fingerprint" to see the API response...
📚 Additional Resources
- GitHub README - Project overview and installation
- Architecture Guide - Deep dive into the Bayesian network
- Integration Guide - Playwright/Puppeteer examples
- Performance Benchmarks - Speed and optimization tips
- Security & Ethics - Responsible usage guidelines
Built for security researchers, ethical hackers, and privacy engineers. Use responsibly.