device-passport 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +10 -7
  2. package/README.md +41 -0
  3. package/assets/ego-profile-manager.png +0 -0
  4. package/dist/adapters/index.cjs +2 -2
  5. package/dist/adapters/index.d.cts +4 -94
  6. package/dist/adapters/index.d.mts +4 -94
  7. package/dist/adapters/index.d.ts +4 -94
  8. package/dist/adapters/index.mjs +2 -2
  9. package/dist/ego/index.cjs +22 -0
  10. package/dist/ego/index.d.cts +5 -0
  11. package/dist/ego/index.d.mts +5 -0
  12. package/dist/ego/index.d.ts +5 -0
  13. package/dist/ego/index.mjs +8 -0
  14. package/dist/evaluator/index.cjs +22 -584
  15. package/dist/evaluator/index.mjs +3 -564
  16. package/dist/geo/index.cjs +1 -1
  17. package/dist/geo/index.d.cts +4 -0
  18. package/dist/geo/index.d.mts +4 -0
  19. package/dist/geo/index.d.ts +4 -0
  20. package/dist/geo/index.mjs +2 -2
  21. package/dist/index.cjs +41 -441
  22. package/dist/index.d.cts +10 -198
  23. package/dist/index.d.mts +10 -198
  24. package/dist/index.d.ts +10 -198
  25. package/dist/index.mjs +7 -418
  26. package/dist/shared/device-passport.BGfRcQNh.mjs +565 -0
  27. package/dist/shared/{device-passport.BPd2-w8e.cjs → device-passport.BKtmLzPt.cjs} +4 -3
  28. package/dist/shared/{device-passport.BBf9OKap.mjs → device-passport.BPQj0qdT.mjs} +4 -3
  29. package/dist/shared/device-passport.CDS7xrj8.d.ts +469 -0
  30. package/dist/shared/device-passport.CfLes-lq.d.cts +469 -0
  31. package/dist/shared/device-passport.CsOWqPIr.d.cts +77 -0
  32. package/dist/shared/device-passport.D7pEnyp2.d.ts +77 -0
  33. package/dist/shared/{device-passport.CLaBZWUV.cjs → device-passport.D9xW6R0B.cjs} +4 -2
  34. package/dist/shared/device-passport.DirQmSd4.d.cts +47 -0
  35. package/dist/shared/device-passport.DirQmSd4.d.mts +47 -0
  36. package/dist/shared/device-passport.DirQmSd4.d.ts +47 -0
  37. package/dist/shared/device-passport.EK4RX7Xd.cjs +584 -0
  38. package/dist/shared/device-passport.ZBspe4ZW.d.mts +77 -0
  39. package/dist/shared/device-passport.dVEqzSEb.d.mts +469 -0
  40. package/dist/shared/{device-passport.NHw_f6HT.mjs → device-passport.gNo82fQ5.mjs} +5 -3
  41. package/dist/shared/device-passport.kekU28UM.mjs +705 -0
  42. package/dist/shared/device-passport.qL4tjwc0.cjs +718 -0
  43. package/dist/storage/index.d.cts +3 -34
  44. package/dist/storage/index.d.mts +3 -34
  45. package/dist/storage/index.d.ts +3 -34
  46. package/dist/types/index.d.cts +183 -1
  47. package/dist/types/index.d.mts +183 -1
  48. package/dist/types/index.d.ts +183 -1
  49. package/package.json +6 -1
package/dist/index.d.cts CHANGED
@@ -1,201 +1,13 @@
1
- import { PassportGeneratorOptions, DevicePassport, BrowserProfile, OperatingSystemProfile, HardwareProfile, UserAgentClientHints, DevicePassportContext, PassportEvaluation, SupportedPlatform, SupportedBrowserName, SupportedArchitecture, BrandVersion } from './types/index.cjs';
2
- export { BenchmarkMetrics, ClientHintsHeaders, ConsistencyCategory, ConsistencyCheck, CpuProfile, DeviceProfile, EntropyAnalysis, EvaluationGrade, EvaluationStatus, GpuProfile, MemoryProfile, ScreenProfile } from './types/index.cjs';
3
- import { PlaywrightContextOptions, PuppeteerEmulationOptions } from './adapters/index.cjs';
4
- export { CANONICAL_HEADER_ORDER, CdpCommand, CdpPassportPlan, PassportLike, applyCdpPassport, applyToPlaywrightContext, applyToPuppeteerPage, formatCanonicalHeaders, getCdpPlan, getPlaywrightContext, getPuppeteerArgs, getStealthScript, toCurl, withPassport } from './adapters/index.cjs';
5
- import { StorageAdapter } from './storage/index.cjs';
6
- export { JSONFileStorage, JSONFileStorageOptions, MemoryStorage, MemoryStorageOptions } from './storage/index.cjs';
7
- import { L as LocaleProfile } from './shared/device-passport.C_F1vBE8.cjs';
8
- export { C as CountryGeoDefinition, G as GeoContext, a as GeoCoordinates, b as GeoLocation, c as GeoOptions, d as LanguageWeight } from './shared/device-passport.C_F1vBE8.cjs';
1
+ export { A as AccountProfileManager, a as AccountProfileManagerOptions, B as BindProfileOptions, b as BuildEgoSessionPlanOptions, C as CreatePassportInputOptions, c as CreateSessionPlanOptions, D as DevicePassportInstance, E as EgoNativeBridge, P as PROXY_MISSING_NOTE, d as PROXY_RESOLUTION_NOTE, e as PassportManager, f as PassportManagerOptions, g as buildEgoSessionPlan, h as buildProxyDeclaration, i as createEgoBridge, j as createPassport, k as defaultTaskSpaceName, l as getEgoNativeBridge, m as getProfileReadiness } from './shared/device-passport.CfLes-lq.cjs';
2
+ import { OperatingSystemProfile, HardwareProfile, SupportedPlatform, SupportedArchitecture, SupportedBrowserName, BrandVersion, UserAgentClientHints, PassportGeneratorOptions, DevicePassport } from './types/index.cjs';
3
+ export { BenchmarkMetrics, BrowserProfile, CdpCommand, CdpInitScript, CdpPassportPlan, ClientHintsHeaders, ConsistencyCategory, ConsistencyCheck, CpuProfile, DevicePassportContext, DeviceProfile, EgoAccountProfile, EgoLiteBridge, EgoProfile, EgoProfileReadiness, EgoProxyBinding, EgoProxyDeclaration, EgoSessionPlan, EntropyAnalysis, EvaluationGrade, EvaluationStatus, GpuProfile, MemoryProfile, PassportEvaluation, ScreenProfile } from './types/index.cjs';
9
4
  export { ALPHA3_TO_ALPHA2, COUNTRY_LOCALES, COUNTRY_NAME_TO_CODE, CountryLocaleConfig, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_COUNTRY, DEFAULT_LOCALE, DEFAULT_TIMEZONE, GEO_LOCALES, GeoDetectOptions, TIMEZONE_MATRIX, TIMEZONE_TO_COUNTRY, alignGeoContext, detectCountry, detectGeoFromUrl, extractCountryFromProxyUrl, formatAcceptLanguage, getAllSupportedCountries, getCountryConfig, getCountryForTimezone, getDefaultTimezoneForCountry, getLocaleProfile, getTimezoneOffsetMinutes, getTimezonesForCountry, hasCountryConfig, isGeoAligned, isTimezoneAlignedWithCountry, isValidCountryCode, isValidTimezone, listAllTimezones, normalizeCountryCode, parseAcceptLanguage, toGeoLocation, toLocaleProfile } from './geo/index.cjs';
5
+ export { CANONICAL_HEADER_ORDER, PassportLike, applyCdpPassport, formatCanonicalHeaders, getCdpPlan, toCurl, withPassport } from './adapters/index.cjs';
6
+ export { P as PlaywrightContextOptions, a as PuppeteerEmulationOptions, b as applyToPlaywrightContext, c as applyToPuppeteerPage, g as getPlaywrightContext, d as getPuppeteerArgs, e as getStealthScript } from './shared/device-passport.CsOWqPIr.cjs';
7
+ export { S as StorageAdapter } from './shared/device-passport.DirQmSd4.cjs';
8
+ export { JSONFileStorage, JSONFileStorageOptions, MemoryStorage, MemoryStorageOptions } from './storage/index.cjs';
10
9
  export { BASELINE_OPTIMAL_ENTROPY, BROWSER_BASELINE_FREQUENCIES, COUNTRY_PRIMARY_LANGUAGES, COUNTRY_TIMEZONE_MAP, CoherenceEvaluationResult, Contradiction, ContradictionCategory, ContradictionSeverity, EntropyAnalysisResult, HeaderEntropyProfile, MIN_STRUCTURAL_ENTROPY, MathematicalModelFormalism, OPTIMAL_CHAR_ENTROPY_MAX, OPTIMAL_CHAR_ENTROPY_MIN, OPTIMAL_ENTROPY_MAX, OPTIMAL_ENTROPY_MIN, SubspaceEvaluation, analyzeHeaderEntropy, calculateKLDivergence, calculateShannonEntropy, calculateStructuralEntropy, detectAllContradictions, detectClientHintsContradictions, detectGeoChronoContradictions, detectHardwareContradictions, detectOSBrowserContradictions, evaluateCoherence, evaluateGeoAlignment, evaluatePassport } from './evaluator/index.cjs';
11
-
12
- /**
13
- * DevicePassportInstance encapsulates a single concrete, zero-contradiction digital identity persona.
14
- *
15
- * Provides runtime adapters for:
16
- * 1. Lightweight HTTP mode (Fetch, Axios, Undici, Got, cURL) with strict canonical header ordering.
17
- * 2. Heavyweight browser automation (Playwright, Puppeteer, ego-lite) with deep fingerprint masking.
18
- * 3. Self-evaluating consistency diagnostics based on empirical telemetry models.
19
- */
20
- declare class DevicePassportInstance {
21
- readonly profile: DevicePassport;
22
- constructor(profile: DevicePassport);
23
- /**
24
- * Factory method to create an instance from a plain DevicePassport object.
25
- */
26
- static from(profile: DevicePassport): DevicePassportInstance;
27
- get id(): string;
28
- get seed(): string;
29
- get createdAt(): string;
30
- get browser(): BrowserProfile;
31
- get os(): OperatingSystemProfile;
32
- get hardware(): HardwareProfile;
33
- get locale(): LocaleProfile;
34
- get headers(): Record<string, string>;
35
- get clientHints(): UserAgentClientHints;
36
- get context(): DevicePassportContext;
37
- get userAgent(): string;
38
- get timezone(): string;
39
- get playwrightContext(): PlaywrightContextOptions;
40
- get puppeteerArgs(): PuppeteerEmulationOptions;
41
- get evaluation(): PassportEvaluation | undefined;
42
- /**
43
- * Returns HTTP headers formatted in strict canonical browser sequence.
44
- * Essential for anti-bot evasion against Cloudflare, Akamai, and DataDome.
45
- */
46
- getHeaders(overrides?: Record<string, string>): Record<string, string>;
47
- /**
48
- * Returns a higher-order fetch function wrapping standard fetch with this passport's canonical persona.
49
- */
50
- wrapFetch(customFetch?: typeof fetch): typeof fetch;
51
- /**
52
- * Alias for wrapFetch.
53
- */
54
- withPassport(customFetch?: typeof fetch): typeof fetch;
55
- /**
56
- * Generates a copy-pasteable cURL command with correct browser headers and User-Agent.
57
- */
58
- toCurl(url: string, options?: {
59
- method?: string;
60
- data?: any;
61
- headers?: Record<string, string>;
62
- }): string;
63
- /**
64
- * Generates Playwright BrowserContext options.
65
- * Usage:
66
- * ```ts
67
- * const context = await browser.newContext(passport.getPlaywrightContext());
68
- * ```
69
- */
70
- getPlaywrightContext(): PlaywrightContextOptions;
71
- /**
72
- * Returns Puppeteer launch args and page emulation parameters.
73
- */
74
- getPuppeteerArgs(): PuppeteerEmulationOptions;
75
- /**
76
- * Generates an in-page stealth script to patch runtime JavaScript APIs
77
- * (navigator.webdriver, hardwareConcurrency, deviceMemory, WebGL, Client Hints).
78
- */
79
- getStealthScript(): string;
80
- /**
81
- * Injects stealth scripts and extra HTTP headers into a Playwright BrowserContext.
82
- */
83
- applyToPlaywright(context: any): Promise<void>;
84
- /**
85
- * Injects stealth scripts and emulation parameters into a Puppeteer Page.
86
- */
87
- applyToPuppeteer(page: any): Promise<void>;
88
- /**
89
- * Evaluates cross-layer consistency and Shannon entropy.
90
- * Caches the result on `this.profile.evaluation`.
91
- */
92
- evaluate(forceRecompute?: boolean): PassportEvaluation;
93
- /**
94
- * Returns the underlying raw DevicePassport data object.
95
- */
96
- toJSON(): DevicePassport;
97
- toString(): string;
98
- }
99
- interface CreatePassportInputOptions extends PassportGeneratorOptions {
100
- /** Optional file path or storage adapter to persist this passport deterministically */
101
- store?: string | StorageAdapter<DevicePassport>;
102
- }
103
- /**
104
- * Universal polymorphic factory for creating a DevicePassportInstance.
105
- *
106
- * Supports:
107
- * - One-line string seed: `createPassport('alice', { geo: 'US' })`
108
- * - Full options object: `createPassport({ seed: 'bot1', store: './passports.json' })`
109
- * - Existing raw profile: `createPassport(rawProfile)`
110
- * - Zero-config ephemeral persona: `createPassport()`
111
- */
112
- declare function createPassport(seedOrOptionsOrProfile?: string | CreatePassportInputOptions | DevicePassport, extraOptions?: CreatePassportInputOptions): DevicePassportInstance;
113
-
114
- interface PassportManagerOptions {
115
- /**
116
- * Storage backend for persisting passports:
117
- * - String path (e.g. './passports.json') -> creates JSONFileStorage automatically.
118
- * - StorageAdapter instance -> custom pluggable storage (Memory, File, Redis, DB).
119
- * - Omitted or 'memory' -> uses MemoryStorage.
120
- */
121
- store?: string | StorageAdapter<DevicePassport>;
122
- /**
123
- * Default geographic country code for newly generated personas (e.g. 'US', 'GB', 'DE', 'JP').
124
- * Defaults to 'US'.
125
- */
126
- defaultGeo?: string;
127
- /**
128
- * Default operating system preference ('macOS' | 'Windows').
129
- */
130
- defaultOS?: SupportedPlatform;
131
- /**
132
- * Default browser preference ('Chrome' | 'Edge').
133
- */
134
- defaultBrowser?: SupportedBrowserName;
135
- /**
136
- * Generator function. Defaults to engine's generatePassport.
137
- */
138
- generator?: (options?: PassportGeneratorOptions) => DevicePassport;
139
- }
140
- /**
141
- * PassportManager manages fleet-scale digital device identities.
142
- *
143
- * Guarantees true sticky identity across runs:
144
- * Calling `getPassport(seed)` with the same seed (e.g. account ID, proxy IP, username)
145
- * will consistently return the exact same device passport across restarts and cron jobs.
146
- */
147
- declare class PassportManager {
148
- readonly storage: StorageAdapter<DevicePassport>;
149
- readonly defaultGeo: string;
150
- readonly defaultOS?: SupportedPlatform;
151
- readonly defaultBrowser?: SupportedBrowserName;
152
- private readonly generator;
153
- constructor(options?: PassportManagerOptions);
154
- /**
155
- * Retrieves an existing sticky passport by seed or deterministically generates
156
- * and persists a new one if it does not already exist.
157
- *
158
- * @param seed Deterministic seed (user ID, account handle, proxy IP, worker slot)
159
- * @param options Generator options to use if persona needs to be created
160
- */
161
- getPassport(seed: string | number, options?: PassportGeneratorOptions): Promise<DevicePassportInstance>;
162
- /**
163
- * Synchronous passport retrieval for environments backed by MemoryStorage or JSONFileStorage.
164
- */
165
- getPassportSync(seed: string | number, options?: PassportGeneratorOptions): DevicePassportInstance;
166
- /**
167
- * Forces re-generation and overwrite of a passport for the given seed.
168
- */
169
- renewPassport(seed: string | number, options?: PassportGeneratorOptions): Promise<DevicePassportInstance>;
170
- /**
171
- * Check if a passport exists in storage for the given seed.
172
- */
173
- hasPassport(seed: string | number): Promise<boolean>;
174
- /**
175
- * Delete a passport from storage.
176
- */
177
- deletePassport(seed: string | number): Promise<boolean>;
178
- /**
179
- * Import an existing passport into storage.
180
- */
181
- importPassport(passport: DevicePassport | DevicePassportInstance): Promise<DevicePassportInstance>;
182
- /**
183
- * List all stored seeds.
184
- */
185
- listSeeds(): Promise<string[]>;
186
- /**
187
- * List all stored passports as DevicePassportInstance objects.
188
- */
189
- listPassports(): Promise<DevicePassportInstance[]>;
190
- /**
191
- * Clear all stored passports.
192
- */
193
- clear(): Promise<void>;
194
- /**
195
- * Return number of stored personas.
196
- */
197
- count(): Promise<number>;
198
- }
10
+ export { C as CountryGeoDefinition, G as GeoContext, a as GeoCoordinates, b as GeoLocation, c as GeoOptions, d as LanguageWeight, L as LocaleProfile } from './shared/device-passport.C_F1vBE8.cjs';
199
11
 
200
12
  /**
201
13
  * Zero-Contradiction Hardware Matrix for Device Passport.
@@ -472,5 +284,5 @@ declare function formatComparativeMatrixJSON(): string;
472
284
  */
473
285
  declare const VERSION = "1.0.0";
474
286
 
475
- export { ALL_PRESETS, BENCHMARK_METRICS_METADATA, BrandVersion, BrowserProfile, CHROME_VERSIONS, COMPARATIVE_DATASET, DevicePassport, DevicePassportContext, DevicePassportInstance, EDGE_VERSIONS, HardwareProfile, LocaleProfile, MACOS_PRESETS, OperatingSystemProfile, PassportEvaluation, PassportGeneratorOptions, PassportManager, PlaywrightContextOptions, PuppeteerEmulationOptions, StorageAdapter, SupportedArchitecture, SupportedBrowserName, SupportedPlatform, UserAgentClientHints, VERSION, WINDOWS_PRESETS, buildUserAgent, createDeterministicPRNG, createMulberry32, createPassport, fnv1a, formatComparativeMatrixJSON, formatComparativeMatrixLaTeX, formatComparativeMatrixMarkdown, formatStructuredBrandList, generateBrandVersions, generateDevicePassport, generatePassport, generateUserAgentClientHints, getApifyHeadersIfAvailable, getHardwarePresets, getPixelProtectionConfig, getPixelProtectionScript, getStaticFallbackHeaders, murmur3, parseStructuredBrandList, runComparativeBenchmark, validateHardwareContradictions };
476
- export type { BenchmarkReportSummary, CanvasNoiseConfig, ClientHintsGenerateOptions, CreatePassportInputOptions, DeviceMatrixPreset, LibraryBenchmarkProfile, MetricMetadata, MetricScore, PassportManagerOptions };
287
+ export { ALL_PRESETS, BENCHMARK_METRICS_METADATA, BrandVersion, CHROME_VERSIONS, COMPARATIVE_DATASET, DevicePassport, EDGE_VERSIONS, HardwareProfile, MACOS_PRESETS, OperatingSystemProfile, PassportGeneratorOptions, SupportedArchitecture, SupportedBrowserName, SupportedPlatform, UserAgentClientHints, VERSION, WINDOWS_PRESETS, buildUserAgent, createDeterministicPRNG, createMulberry32, fnv1a, formatComparativeMatrixJSON, formatComparativeMatrixLaTeX, formatComparativeMatrixMarkdown, formatStructuredBrandList, generateBrandVersions, generateDevicePassport, generatePassport, generateUserAgentClientHints, getApifyHeadersIfAvailable, getHardwarePresets, getPixelProtectionConfig, getPixelProtectionScript, getStaticFallbackHeaders, murmur3, parseStructuredBrandList, runComparativeBenchmark, validateHardwareContradictions };
288
+ export type { BenchmarkReportSummary, CanvasNoiseConfig, ClientHintsGenerateOptions, DeviceMatrixPreset, LibraryBenchmarkProfile, MetricMetadata, MetricScore };
package/dist/index.d.mts CHANGED
@@ -1,201 +1,13 @@
1
- import { PassportGeneratorOptions, DevicePassport, BrowserProfile, OperatingSystemProfile, HardwareProfile, UserAgentClientHints, DevicePassportContext, PassportEvaluation, SupportedPlatform, SupportedBrowserName, SupportedArchitecture, BrandVersion } from './types/index.mjs';
2
- export { BenchmarkMetrics, ClientHintsHeaders, ConsistencyCategory, ConsistencyCheck, CpuProfile, DeviceProfile, EntropyAnalysis, EvaluationGrade, EvaluationStatus, GpuProfile, MemoryProfile, ScreenProfile } from './types/index.mjs';
3
- import { PlaywrightContextOptions, PuppeteerEmulationOptions } from './adapters/index.mjs';
4
- export { CANONICAL_HEADER_ORDER, CdpCommand, CdpPassportPlan, PassportLike, applyCdpPassport, applyToPlaywrightContext, applyToPuppeteerPage, formatCanonicalHeaders, getCdpPlan, getPlaywrightContext, getPuppeteerArgs, getStealthScript, toCurl, withPassport } from './adapters/index.mjs';
5
- import { StorageAdapter } from './storage/index.mjs';
6
- export { JSONFileStorage, JSONFileStorageOptions, MemoryStorage, MemoryStorageOptions } from './storage/index.mjs';
7
- import { L as LocaleProfile } from './shared/device-passport.C_F1vBE8.mjs';
8
- export { C as CountryGeoDefinition, G as GeoContext, a as GeoCoordinates, b as GeoLocation, c as GeoOptions, d as LanguageWeight } from './shared/device-passport.C_F1vBE8.mjs';
1
+ export { A as AccountProfileManager, a as AccountProfileManagerOptions, B as BindProfileOptions, b as BuildEgoSessionPlanOptions, C as CreatePassportInputOptions, c as CreateSessionPlanOptions, D as DevicePassportInstance, E as EgoNativeBridge, P as PROXY_MISSING_NOTE, d as PROXY_RESOLUTION_NOTE, e as PassportManager, f as PassportManagerOptions, g as buildEgoSessionPlan, h as buildProxyDeclaration, i as createEgoBridge, j as createPassport, k as defaultTaskSpaceName, l as getEgoNativeBridge, m as getProfileReadiness } from './shared/device-passport.dVEqzSEb.mjs';
2
+ import { OperatingSystemProfile, HardwareProfile, SupportedPlatform, SupportedArchitecture, SupportedBrowserName, BrandVersion, UserAgentClientHints, PassportGeneratorOptions, DevicePassport } from './types/index.mjs';
3
+ export { BenchmarkMetrics, BrowserProfile, CdpCommand, CdpInitScript, CdpPassportPlan, ClientHintsHeaders, ConsistencyCategory, ConsistencyCheck, CpuProfile, DevicePassportContext, DeviceProfile, EgoAccountProfile, EgoLiteBridge, EgoProfile, EgoProfileReadiness, EgoProxyBinding, EgoProxyDeclaration, EgoSessionPlan, EntropyAnalysis, EvaluationGrade, EvaluationStatus, GpuProfile, MemoryProfile, PassportEvaluation, ScreenProfile } from './types/index.mjs';
9
4
  export { ALPHA3_TO_ALPHA2, COUNTRY_LOCALES, COUNTRY_NAME_TO_CODE, CountryLocaleConfig, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_COUNTRY, DEFAULT_LOCALE, DEFAULT_TIMEZONE, GEO_LOCALES, GeoDetectOptions, TIMEZONE_MATRIX, TIMEZONE_TO_COUNTRY, alignGeoContext, detectCountry, detectGeoFromUrl, extractCountryFromProxyUrl, formatAcceptLanguage, getAllSupportedCountries, getCountryConfig, getCountryForTimezone, getDefaultTimezoneForCountry, getLocaleProfile, getTimezoneOffsetMinutes, getTimezonesForCountry, hasCountryConfig, isGeoAligned, isTimezoneAlignedWithCountry, isValidCountryCode, isValidTimezone, listAllTimezones, normalizeCountryCode, parseAcceptLanguage, toGeoLocation, toLocaleProfile } from './geo/index.mjs';
5
+ export { CANONICAL_HEADER_ORDER, PassportLike, applyCdpPassport, formatCanonicalHeaders, getCdpPlan, toCurl, withPassport } from './adapters/index.mjs';
6
+ export { P as PlaywrightContextOptions, a as PuppeteerEmulationOptions, b as applyToPlaywrightContext, c as applyToPuppeteerPage, g as getPlaywrightContext, d as getPuppeteerArgs, e as getStealthScript } from './shared/device-passport.ZBspe4ZW.mjs';
7
+ export { S as StorageAdapter } from './shared/device-passport.DirQmSd4.mjs';
8
+ export { JSONFileStorage, JSONFileStorageOptions, MemoryStorage, MemoryStorageOptions } from './storage/index.mjs';
10
9
  export { BASELINE_OPTIMAL_ENTROPY, BROWSER_BASELINE_FREQUENCIES, COUNTRY_PRIMARY_LANGUAGES, COUNTRY_TIMEZONE_MAP, CoherenceEvaluationResult, Contradiction, ContradictionCategory, ContradictionSeverity, EntropyAnalysisResult, HeaderEntropyProfile, MIN_STRUCTURAL_ENTROPY, MathematicalModelFormalism, OPTIMAL_CHAR_ENTROPY_MAX, OPTIMAL_CHAR_ENTROPY_MIN, OPTIMAL_ENTROPY_MAX, OPTIMAL_ENTROPY_MIN, SubspaceEvaluation, analyzeHeaderEntropy, calculateKLDivergence, calculateShannonEntropy, calculateStructuralEntropy, detectAllContradictions, detectClientHintsContradictions, detectGeoChronoContradictions, detectHardwareContradictions, detectOSBrowserContradictions, evaluateCoherence, evaluateGeoAlignment, evaluatePassport } from './evaluator/index.mjs';
11
-
12
- /**
13
- * DevicePassportInstance encapsulates a single concrete, zero-contradiction digital identity persona.
14
- *
15
- * Provides runtime adapters for:
16
- * 1. Lightweight HTTP mode (Fetch, Axios, Undici, Got, cURL) with strict canonical header ordering.
17
- * 2. Heavyweight browser automation (Playwright, Puppeteer, ego-lite) with deep fingerprint masking.
18
- * 3. Self-evaluating consistency diagnostics based on empirical telemetry models.
19
- */
20
- declare class DevicePassportInstance {
21
- readonly profile: DevicePassport;
22
- constructor(profile: DevicePassport);
23
- /**
24
- * Factory method to create an instance from a plain DevicePassport object.
25
- */
26
- static from(profile: DevicePassport): DevicePassportInstance;
27
- get id(): string;
28
- get seed(): string;
29
- get createdAt(): string;
30
- get browser(): BrowserProfile;
31
- get os(): OperatingSystemProfile;
32
- get hardware(): HardwareProfile;
33
- get locale(): LocaleProfile;
34
- get headers(): Record<string, string>;
35
- get clientHints(): UserAgentClientHints;
36
- get context(): DevicePassportContext;
37
- get userAgent(): string;
38
- get timezone(): string;
39
- get playwrightContext(): PlaywrightContextOptions;
40
- get puppeteerArgs(): PuppeteerEmulationOptions;
41
- get evaluation(): PassportEvaluation | undefined;
42
- /**
43
- * Returns HTTP headers formatted in strict canonical browser sequence.
44
- * Essential for anti-bot evasion against Cloudflare, Akamai, and DataDome.
45
- */
46
- getHeaders(overrides?: Record<string, string>): Record<string, string>;
47
- /**
48
- * Returns a higher-order fetch function wrapping standard fetch with this passport's canonical persona.
49
- */
50
- wrapFetch(customFetch?: typeof fetch): typeof fetch;
51
- /**
52
- * Alias for wrapFetch.
53
- */
54
- withPassport(customFetch?: typeof fetch): typeof fetch;
55
- /**
56
- * Generates a copy-pasteable cURL command with correct browser headers and User-Agent.
57
- */
58
- toCurl(url: string, options?: {
59
- method?: string;
60
- data?: any;
61
- headers?: Record<string, string>;
62
- }): string;
63
- /**
64
- * Generates Playwright BrowserContext options.
65
- * Usage:
66
- * ```ts
67
- * const context = await browser.newContext(passport.getPlaywrightContext());
68
- * ```
69
- */
70
- getPlaywrightContext(): PlaywrightContextOptions;
71
- /**
72
- * Returns Puppeteer launch args and page emulation parameters.
73
- */
74
- getPuppeteerArgs(): PuppeteerEmulationOptions;
75
- /**
76
- * Generates an in-page stealth script to patch runtime JavaScript APIs
77
- * (navigator.webdriver, hardwareConcurrency, deviceMemory, WebGL, Client Hints).
78
- */
79
- getStealthScript(): string;
80
- /**
81
- * Injects stealth scripts and extra HTTP headers into a Playwright BrowserContext.
82
- */
83
- applyToPlaywright(context: any): Promise<void>;
84
- /**
85
- * Injects stealth scripts and emulation parameters into a Puppeteer Page.
86
- */
87
- applyToPuppeteer(page: any): Promise<void>;
88
- /**
89
- * Evaluates cross-layer consistency and Shannon entropy.
90
- * Caches the result on `this.profile.evaluation`.
91
- */
92
- evaluate(forceRecompute?: boolean): PassportEvaluation;
93
- /**
94
- * Returns the underlying raw DevicePassport data object.
95
- */
96
- toJSON(): DevicePassport;
97
- toString(): string;
98
- }
99
- interface CreatePassportInputOptions extends PassportGeneratorOptions {
100
- /** Optional file path or storage adapter to persist this passport deterministically */
101
- store?: string | StorageAdapter<DevicePassport>;
102
- }
103
- /**
104
- * Universal polymorphic factory for creating a DevicePassportInstance.
105
- *
106
- * Supports:
107
- * - One-line string seed: `createPassport('alice', { geo: 'US' })`
108
- * - Full options object: `createPassport({ seed: 'bot1', store: './passports.json' })`
109
- * - Existing raw profile: `createPassport(rawProfile)`
110
- * - Zero-config ephemeral persona: `createPassport()`
111
- */
112
- declare function createPassport(seedOrOptionsOrProfile?: string | CreatePassportInputOptions | DevicePassport, extraOptions?: CreatePassportInputOptions): DevicePassportInstance;
113
-
114
- interface PassportManagerOptions {
115
- /**
116
- * Storage backend for persisting passports:
117
- * - String path (e.g. './passports.json') -> creates JSONFileStorage automatically.
118
- * - StorageAdapter instance -> custom pluggable storage (Memory, File, Redis, DB).
119
- * - Omitted or 'memory' -> uses MemoryStorage.
120
- */
121
- store?: string | StorageAdapter<DevicePassport>;
122
- /**
123
- * Default geographic country code for newly generated personas (e.g. 'US', 'GB', 'DE', 'JP').
124
- * Defaults to 'US'.
125
- */
126
- defaultGeo?: string;
127
- /**
128
- * Default operating system preference ('macOS' | 'Windows').
129
- */
130
- defaultOS?: SupportedPlatform;
131
- /**
132
- * Default browser preference ('Chrome' | 'Edge').
133
- */
134
- defaultBrowser?: SupportedBrowserName;
135
- /**
136
- * Generator function. Defaults to engine's generatePassport.
137
- */
138
- generator?: (options?: PassportGeneratorOptions) => DevicePassport;
139
- }
140
- /**
141
- * PassportManager manages fleet-scale digital device identities.
142
- *
143
- * Guarantees true sticky identity across runs:
144
- * Calling `getPassport(seed)` with the same seed (e.g. account ID, proxy IP, username)
145
- * will consistently return the exact same device passport across restarts and cron jobs.
146
- */
147
- declare class PassportManager {
148
- readonly storage: StorageAdapter<DevicePassport>;
149
- readonly defaultGeo: string;
150
- readonly defaultOS?: SupportedPlatform;
151
- readonly defaultBrowser?: SupportedBrowserName;
152
- private readonly generator;
153
- constructor(options?: PassportManagerOptions);
154
- /**
155
- * Retrieves an existing sticky passport by seed or deterministically generates
156
- * and persists a new one if it does not already exist.
157
- *
158
- * @param seed Deterministic seed (user ID, account handle, proxy IP, worker slot)
159
- * @param options Generator options to use if persona needs to be created
160
- */
161
- getPassport(seed: string | number, options?: PassportGeneratorOptions): Promise<DevicePassportInstance>;
162
- /**
163
- * Synchronous passport retrieval for environments backed by MemoryStorage or JSONFileStorage.
164
- */
165
- getPassportSync(seed: string | number, options?: PassportGeneratorOptions): DevicePassportInstance;
166
- /**
167
- * Forces re-generation and overwrite of a passport for the given seed.
168
- */
169
- renewPassport(seed: string | number, options?: PassportGeneratorOptions): Promise<DevicePassportInstance>;
170
- /**
171
- * Check if a passport exists in storage for the given seed.
172
- */
173
- hasPassport(seed: string | number): Promise<boolean>;
174
- /**
175
- * Delete a passport from storage.
176
- */
177
- deletePassport(seed: string | number): Promise<boolean>;
178
- /**
179
- * Import an existing passport into storage.
180
- */
181
- importPassport(passport: DevicePassport | DevicePassportInstance): Promise<DevicePassportInstance>;
182
- /**
183
- * List all stored seeds.
184
- */
185
- listSeeds(): Promise<string[]>;
186
- /**
187
- * List all stored passports as DevicePassportInstance objects.
188
- */
189
- listPassports(): Promise<DevicePassportInstance[]>;
190
- /**
191
- * Clear all stored passports.
192
- */
193
- clear(): Promise<void>;
194
- /**
195
- * Return number of stored personas.
196
- */
197
- count(): Promise<number>;
198
- }
10
+ export { C as CountryGeoDefinition, G as GeoContext, a as GeoCoordinates, b as GeoLocation, c as GeoOptions, d as LanguageWeight, L as LocaleProfile } from './shared/device-passport.C_F1vBE8.mjs';
199
11
 
200
12
  /**
201
13
  * Zero-Contradiction Hardware Matrix for Device Passport.
@@ -472,5 +284,5 @@ declare function formatComparativeMatrixJSON(): string;
472
284
  */
473
285
  declare const VERSION = "1.0.0";
474
286
 
475
- export { ALL_PRESETS, BENCHMARK_METRICS_METADATA, BrandVersion, BrowserProfile, CHROME_VERSIONS, COMPARATIVE_DATASET, DevicePassport, DevicePassportContext, DevicePassportInstance, EDGE_VERSIONS, HardwareProfile, LocaleProfile, MACOS_PRESETS, OperatingSystemProfile, PassportEvaluation, PassportGeneratorOptions, PassportManager, PlaywrightContextOptions, PuppeteerEmulationOptions, StorageAdapter, SupportedArchitecture, SupportedBrowserName, SupportedPlatform, UserAgentClientHints, VERSION, WINDOWS_PRESETS, buildUserAgent, createDeterministicPRNG, createMulberry32, createPassport, fnv1a, formatComparativeMatrixJSON, formatComparativeMatrixLaTeX, formatComparativeMatrixMarkdown, formatStructuredBrandList, generateBrandVersions, generateDevicePassport, generatePassport, generateUserAgentClientHints, getApifyHeadersIfAvailable, getHardwarePresets, getPixelProtectionConfig, getPixelProtectionScript, getStaticFallbackHeaders, murmur3, parseStructuredBrandList, runComparativeBenchmark, validateHardwareContradictions };
476
- export type { BenchmarkReportSummary, CanvasNoiseConfig, ClientHintsGenerateOptions, CreatePassportInputOptions, DeviceMatrixPreset, LibraryBenchmarkProfile, MetricMetadata, MetricScore, PassportManagerOptions };
287
+ export { ALL_PRESETS, BENCHMARK_METRICS_METADATA, BrandVersion, CHROME_VERSIONS, COMPARATIVE_DATASET, DevicePassport, EDGE_VERSIONS, HardwareProfile, MACOS_PRESETS, OperatingSystemProfile, PassportGeneratorOptions, SupportedArchitecture, SupportedBrowserName, SupportedPlatform, UserAgentClientHints, VERSION, WINDOWS_PRESETS, buildUserAgent, createDeterministicPRNG, createMulberry32, fnv1a, formatComparativeMatrixJSON, formatComparativeMatrixLaTeX, formatComparativeMatrixMarkdown, formatStructuredBrandList, generateBrandVersions, generateDevicePassport, generatePassport, generateUserAgentClientHints, getApifyHeadersIfAvailable, getHardwarePresets, getPixelProtectionConfig, getPixelProtectionScript, getStaticFallbackHeaders, murmur3, parseStructuredBrandList, runComparativeBenchmark, validateHardwareContradictions };
288
+ export type { BenchmarkReportSummary, CanvasNoiseConfig, ClientHintsGenerateOptions, DeviceMatrixPreset, LibraryBenchmarkProfile, MetricMetadata, MetricScore };