@webdecoy/client 0.3.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.
- package/README.md +108 -0
- package/dist/index.d.mts +469 -0
- package/dist/index.d.ts +469 -0
- package/dist/index.js +2335 -0
- package/dist/index.mjs +2312 -0
- package/dist/webdecoy.global.js +110 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @webdecoy/client
|
|
2
|
+
|
|
3
|
+
Browser widget for [WebDecoy](https://github.com/WebDecoy/node-sdk) captcha — collects behavioral, environmental, and fingerprint signals, solves a SHA-256 proof-of-work, and submits to your WebDecoy-protected server.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@webdecoy/client)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Pairs with the in-process detection engine in [`@webdecoy/node`](https://www.npmjs.com/package/@webdecoy/node).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @webdecoy/client
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or load the standalone bundle directly via `<script>`:
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<script src="https://unpkg.com/@webdecoy/client/dist/webdecoy.global.js"></script>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Checkbox widget
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<div id="captcha-box"></div>
|
|
28
|
+
<script type="module">
|
|
29
|
+
import { WebDecoyCaptcha } from '@webdecoy/client';
|
|
30
|
+
|
|
31
|
+
WebDecoyCaptcha.configure({ serverUrl: 'https://your-server.com' });
|
|
32
|
+
const id = WebDecoyCaptcha.render('captcha-box', {
|
|
33
|
+
siteKey: 'pk_live_...',
|
|
34
|
+
theme: 'light',
|
|
35
|
+
callback: (token) => console.log('verified:', token),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Later: WebDecoyCaptcha.getResponse(id) → token
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Auto-init (no JS)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<div data-webdecoy="pk_live_..." data-endpoint="https://your-server.com"></div>
|
|
46
|
+
<script src="https://unpkg.com/@webdecoy/client/dist/webdecoy.global.js"></script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Invisible mode
|
|
50
|
+
|
|
51
|
+
Passively scores the session and auto-protects form submissions (injects a
|
|
52
|
+
hidden `webdecoy_token` field, scores on submit):
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import { WebDecoyCaptcha } from '@webdecoy/client';
|
|
56
|
+
|
|
57
|
+
WebDecoyCaptcha.configure({ serverUrl: 'https://your-server.com' });
|
|
58
|
+
WebDecoyCaptcha.invisible({ siteKey: 'pk_live_...' });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or score on demand:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
const result = await WebDecoyCaptcha.execute('pk_live_...', { action: 'login' });
|
|
65
|
+
if (result.success) { /* result.token */ }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## What it collects
|
|
69
|
+
|
|
70
|
+
| Group | Signals |
|
|
71
|
+
|-------|---------|
|
|
72
|
+
| Behavioral | mouse trajectory/velocity/micro-tremor, click precision, touch kinematics, scroll, keystroke cadence |
|
|
73
|
+
| Sensor | device motion/orientation entropy (mobile) |
|
|
74
|
+
| Environmental | WebDriver/CDP/Playwright markers, canvas, WebGL, audio, fonts, WebRTC, speech, worker consistency, CSS media, permissions, DOMRect, RAF/JS timing |
|
|
75
|
+
| Form | submit method, per-field textarea typing stats |
|
|
76
|
+
|
|
77
|
+
Signals are hashed and bound into the proof-of-work so they can't be tampered
|
|
78
|
+
with after solving. The server scores them with `@webdecoy/node`.
|
|
79
|
+
|
|
80
|
+
## Server setup
|
|
81
|
+
|
|
82
|
+
Mount the matching endpoints on your backend (default base path `/__webdecoy`):
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import express from 'express';
|
|
86
|
+
import { webdecoyCaptcha } from '@webdecoy/express';
|
|
87
|
+
|
|
88
|
+
const app = express();
|
|
89
|
+
app.use(express.json());
|
|
90
|
+
app.use(webdecoyCaptcha({ secret: process.env.WEBDECOY_SECRET }));
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See [`@webdecoy/node`](https://www.npmjs.com/package/@webdecoy/node) for Fastify
|
|
94
|
+
and Next.js adapters and the full detection/scoring reference.
|
|
95
|
+
|
|
96
|
+
## API
|
|
97
|
+
|
|
98
|
+
- `WebDecoyCaptcha.configure({ serverUrl })`
|
|
99
|
+
- `WebDecoyCaptcha.render(container, options) → widgetId`
|
|
100
|
+
- `WebDecoyCaptcha.getResponse(widgetId) → token | null`
|
|
101
|
+
- `WebDecoyCaptcha.reset(widgetId)`
|
|
102
|
+
- `WebDecoyCaptcha.invisible(options) → InvisibleSession`
|
|
103
|
+
- `WebDecoyCaptcha.execute(siteKey, { action, minTime, powDifficulty }) → Promise<result>`
|
|
104
|
+
- `WebDecoyCaptcha.autoInit()`
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
/** Public types for the WebDecoy browser client. */
|
|
2
|
+
/** Assembled signal payload sent to the server for scoring. */
|
|
3
|
+
interface CollectedSignals {
|
|
4
|
+
behavioral: Record<string, unknown>;
|
|
5
|
+
environmental: Record<string, unknown>;
|
|
6
|
+
temporal: Record<string, unknown>;
|
|
7
|
+
formAnalysis: Record<string, unknown>;
|
|
8
|
+
meta: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/** A solved proof-of-work challenge. */
|
|
11
|
+
interface PoWSolution {
|
|
12
|
+
challengeId: string;
|
|
13
|
+
nonce: number;
|
|
14
|
+
hash: string;
|
|
15
|
+
iterations: number;
|
|
16
|
+
duration: number;
|
|
17
|
+
difficulty: number;
|
|
18
|
+
signalsHash: string | null;
|
|
19
|
+
local: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Challenge as returned by `/api/pow/challenge`. */
|
|
22
|
+
interface Challenge {
|
|
23
|
+
challengeId: string;
|
|
24
|
+
prefix: string;
|
|
25
|
+
difficulty: number;
|
|
26
|
+
expiresAt: number;
|
|
27
|
+
nonce?: string;
|
|
28
|
+
sig?: string;
|
|
29
|
+
local?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Server verify/score response. */
|
|
32
|
+
interface VerifyResponse {
|
|
33
|
+
success: boolean;
|
|
34
|
+
score?: number;
|
|
35
|
+
token?: string | null;
|
|
36
|
+
recommendation?: 'allow' | 'challenge' | 'block';
|
|
37
|
+
action?: string;
|
|
38
|
+
message?: string | null;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
/** Options for the checkbox widget. */
|
|
42
|
+
interface WidgetOptions {
|
|
43
|
+
siteKey?: string | null;
|
|
44
|
+
theme?: 'light' | 'dark';
|
|
45
|
+
size?: 'normal' | 'compact';
|
|
46
|
+
powDifficulty?: number;
|
|
47
|
+
callback?: ((token: string) => void) | null;
|
|
48
|
+
errorCallback?: ((message?: string) => void) | null;
|
|
49
|
+
expiredCallback?: (() => void) | null;
|
|
50
|
+
}
|
|
51
|
+
/** Options for an invisible (zero-click) session. */
|
|
52
|
+
interface InvisibleOptions {
|
|
53
|
+
siteKey?: string | null;
|
|
54
|
+
serverUrl?: string | null;
|
|
55
|
+
minCollectionTime?: number;
|
|
56
|
+
autoScore?: boolean;
|
|
57
|
+
scoreThreshold?: number;
|
|
58
|
+
powDifficulty?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Checkbox captcha widget ("I'm not a robot").
|
|
63
|
+
*
|
|
64
|
+
* Collects signals on click, hashes them, binds them into a PoW solution, and
|
|
65
|
+
* submits to the server's `/api/verify`. Falls back to a lightweight local
|
|
66
|
+
* verdict when no server is configured. Ported from FCaptcha client.js.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
declare class CaptchaWidget {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
private container;
|
|
72
|
+
private options;
|
|
73
|
+
private behavioral;
|
|
74
|
+
private environmental;
|
|
75
|
+
private temporal;
|
|
76
|
+
private sensor;
|
|
77
|
+
private powManager;
|
|
78
|
+
private token;
|
|
79
|
+
private verified;
|
|
80
|
+
private checkbox;
|
|
81
|
+
private spinner;
|
|
82
|
+
private label;
|
|
83
|
+
constructor(container: string | HTMLElement, options?: WidgetOptions);
|
|
84
|
+
private _init;
|
|
85
|
+
private _fetchChallenge;
|
|
86
|
+
private _createWidget;
|
|
87
|
+
private _attachListeners;
|
|
88
|
+
private _handleClick;
|
|
89
|
+
private _verify;
|
|
90
|
+
private _clientSideVerify;
|
|
91
|
+
private _showSuccess;
|
|
92
|
+
private _showFailure;
|
|
93
|
+
getToken(): string | null;
|
|
94
|
+
reset(): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Invisible (zero-click) session.
|
|
99
|
+
*
|
|
100
|
+
* Passively collects signals, optionally auto-protecting form submissions:
|
|
101
|
+
* intercepts submit, scores via `/api/score`, injects a token field, and
|
|
102
|
+
* resubmits. Ported from FCaptcha client.js.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
declare class InvisibleSession {
|
|
106
|
+
readonly id: string;
|
|
107
|
+
private options;
|
|
108
|
+
private behavioral;
|
|
109
|
+
private environmental;
|
|
110
|
+
private temporal;
|
|
111
|
+
private sensor;
|
|
112
|
+
private powManager;
|
|
113
|
+
private startTime;
|
|
114
|
+
private lastScore;
|
|
115
|
+
private listeners;
|
|
116
|
+
constructor(options?: InvisibleOptions);
|
|
117
|
+
private _init;
|
|
118
|
+
private _fetchChallenge;
|
|
119
|
+
private _attachListeners;
|
|
120
|
+
private _attachToForms;
|
|
121
|
+
execute(action?: string): Promise<VerifyResponse>;
|
|
122
|
+
private _score;
|
|
123
|
+
private _clientSideScore;
|
|
124
|
+
getScore(): (VerifyResponse & {
|
|
125
|
+
timestamp: number;
|
|
126
|
+
}) | null;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Public API for the WebDecoy browser client.
|
|
132
|
+
*
|
|
133
|
+
* Mirrors the FCaptcha global surface: render a checkbox widget, run an
|
|
134
|
+
* invisible session, execute a one-shot score, configure the server origin, and
|
|
135
|
+
* auto-initialize `[data-webdecoy]` elements. Ported from FCaptcha client.js.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
type AnyWidget = CaptchaWidget | InvisibleSession;
|
|
139
|
+
interface WebDecoyCaptchaAPI {
|
|
140
|
+
widgets: Map<string, AnyWidget>;
|
|
141
|
+
get serverUrl(): string | null;
|
|
142
|
+
set serverUrl(url: string | null);
|
|
143
|
+
configure(options: {
|
|
144
|
+
serverUrl?: string;
|
|
145
|
+
basePath?: string;
|
|
146
|
+
}): void;
|
|
147
|
+
render(container: string | HTMLElement, options?: WidgetOptions): string;
|
|
148
|
+
getResponse(widgetId: string): string | null;
|
|
149
|
+
reset(widgetId: string): void;
|
|
150
|
+
invisible(options?: InvisibleOptions): InvisibleSession;
|
|
151
|
+
execute(siteKey: string, options?: {
|
|
152
|
+
action?: string;
|
|
153
|
+
minTime?: number;
|
|
154
|
+
powDifficulty?: number;
|
|
155
|
+
}): Promise<VerifyResponse>;
|
|
156
|
+
getSignals(): {
|
|
157
|
+
environmental: Record<string, unknown>;
|
|
158
|
+
};
|
|
159
|
+
autoInit(): void;
|
|
160
|
+
}
|
|
161
|
+
declare const WebDecoyCaptcha: WebDecoyCaptchaAPI;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Client-side proof-of-work solver.
|
|
165
|
+
*
|
|
166
|
+
* Fetches a challenge from the server, then solves it across multiple inline
|
|
167
|
+
* Web Workers (disjoint nonce slices via striding). Falls back to a local
|
|
168
|
+
* challenge when no server is configured. Ported from FCaptcha client.js.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
declare class PoWManager {
|
|
172
|
+
private workers;
|
|
173
|
+
challenge: Challenge | null;
|
|
174
|
+
solution: PoWSolution | null;
|
|
175
|
+
private solving;
|
|
176
|
+
private solvePromise;
|
|
177
|
+
private startTime;
|
|
178
|
+
/**
|
|
179
|
+
* Inline Web Worker for PoW computation. Each worker scans a disjoint nonce
|
|
180
|
+
* slice via `(startNonce + k*stride)`, so N workers explore the space N-way.
|
|
181
|
+
*/
|
|
182
|
+
private _createWorker;
|
|
183
|
+
/** Use half of hardwareConcurrency, leaving headroom for the page. */
|
|
184
|
+
private _threadCount;
|
|
185
|
+
private _terminateWorkers;
|
|
186
|
+
fetchChallenge(siteKey?: string | null): Promise<Challenge>;
|
|
187
|
+
private _generateLocalChallenge;
|
|
188
|
+
/** Solve without signals binding (legacy). */
|
|
189
|
+
startSolving(siteKey?: string | null): Promise<PoWSolution>;
|
|
190
|
+
/** Solve with a signals hash bound into the PoW input. */
|
|
191
|
+
solveWithSignalsHash(siteKey: string | null | undefined, signalsHash: string): Promise<PoWSolution>;
|
|
192
|
+
private _solve;
|
|
193
|
+
getSolution(siteKey?: string | null): Promise<PoWSolution>;
|
|
194
|
+
reset(): void;
|
|
195
|
+
}
|
|
196
|
+
declare function getPoWManager(): PoWManager;
|
|
197
|
+
|
|
198
|
+
/** Temporal signal collector: page-load → interaction → click timing + PoW. */
|
|
199
|
+
declare class TemporalCollector {
|
|
200
|
+
private pageLoadTime;
|
|
201
|
+
private firstInteractionTime;
|
|
202
|
+
powResult: Record<string, unknown> | null;
|
|
203
|
+
constructor();
|
|
204
|
+
recordFirstInteraction(): void;
|
|
205
|
+
/** Legacy single-threaded PoW (prefer PoWManager). */
|
|
206
|
+
performProofOfWork(difficulty?: number): Promise<Record<string, unknown>>;
|
|
207
|
+
collect(clickTime?: number): Record<string, unknown>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface MousePosition {
|
|
211
|
+
x: number;
|
|
212
|
+
y: number;
|
|
213
|
+
t: number;
|
|
214
|
+
}
|
|
215
|
+
interface VelocitySample {
|
|
216
|
+
v: number;
|
|
217
|
+
t: number;
|
|
218
|
+
}
|
|
219
|
+
interface AccelerationSample {
|
|
220
|
+
a: number;
|
|
221
|
+
t: number;
|
|
222
|
+
}
|
|
223
|
+
interface ScrollSample {
|
|
224
|
+
x: number;
|
|
225
|
+
y: number;
|
|
226
|
+
t: number;
|
|
227
|
+
}
|
|
228
|
+
interface KeyEventSample {
|
|
229
|
+
type: string;
|
|
230
|
+
keyLength: number;
|
|
231
|
+
t: number;
|
|
232
|
+
}
|
|
233
|
+
interface TouchSample {
|
|
234
|
+
x: number;
|
|
235
|
+
y: number;
|
|
236
|
+
t: number;
|
|
237
|
+
force: number;
|
|
238
|
+
radiusX: number;
|
|
239
|
+
radiusY: number;
|
|
240
|
+
rotationAngle: number;
|
|
241
|
+
identifier: number;
|
|
242
|
+
touchCount: number;
|
|
243
|
+
}
|
|
244
|
+
interface PointerSample {
|
|
245
|
+
x: number;
|
|
246
|
+
y: number;
|
|
247
|
+
t: number;
|
|
248
|
+
type: string;
|
|
249
|
+
pressure: number;
|
|
250
|
+
tiltX: number;
|
|
251
|
+
tiltY: number;
|
|
252
|
+
tangentialPressure: number;
|
|
253
|
+
pointerType: string;
|
|
254
|
+
}
|
|
255
|
+
interface FocusEventSample {
|
|
256
|
+
type: string;
|
|
257
|
+
target: string | undefined;
|
|
258
|
+
t: number;
|
|
259
|
+
}
|
|
260
|
+
interface ClickData {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
button: number;
|
|
264
|
+
downTime: number;
|
|
265
|
+
upTime?: number;
|
|
266
|
+
holdDuration?: number;
|
|
267
|
+
}
|
|
268
|
+
declare class BehavioralCollector {
|
|
269
|
+
mousePositions: MousePosition[];
|
|
270
|
+
mouseVelocities: VelocitySample[];
|
|
271
|
+
mouseAccelerations: AccelerationSample[];
|
|
272
|
+
scrollEvents: ScrollSample[];
|
|
273
|
+
keyEvents: KeyEventSample[];
|
|
274
|
+
touchEvents: TouchSample[];
|
|
275
|
+
touchMultiTouchSeen: boolean;
|
|
276
|
+
touchIdentifiers: Set<number>;
|
|
277
|
+
pointerPoints: PointerSample[];
|
|
278
|
+
focusEvents: FocusEventSample[];
|
|
279
|
+
clickData: ClickData | null;
|
|
280
|
+
startTime: number;
|
|
281
|
+
lastMousePos: {
|
|
282
|
+
x: number;
|
|
283
|
+
y: number;
|
|
284
|
+
} | null;
|
|
285
|
+
lastMouseTime: number | null;
|
|
286
|
+
lastVelocity: number | null;
|
|
287
|
+
eventDeltas: number[];
|
|
288
|
+
constructor();
|
|
289
|
+
recordMouseMove(e: MouseEvent): void;
|
|
290
|
+
recordMouseDown(e: MouseEvent): void;
|
|
291
|
+
recordMouseUp(_e: MouseEvent): void;
|
|
292
|
+
recordScroll(_e: Event): void;
|
|
293
|
+
recordKeyEvent(e: KeyboardEvent): void;
|
|
294
|
+
recordTouch(e: TouchEvent): void;
|
|
295
|
+
recordPointer(e: PointerEvent): void;
|
|
296
|
+
recordFocus(e: FocusEvent): void;
|
|
297
|
+
analyze(): Record<string, unknown>;
|
|
298
|
+
_analyzeTouchPoints(touches: TouchSample[]): Record<string, unknown>;
|
|
299
|
+
_analyzePointerPoints(points: PointerSample[]): Record<string, unknown>;
|
|
300
|
+
analyzeClick(clickX: number, clickY: number, targetRect: DOMRect): Record<string, unknown>;
|
|
301
|
+
_detectMicroTremor(positions: {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
t: number;
|
|
305
|
+
}[]): number;
|
|
306
|
+
_calculateStraightLineRatio(positions: {
|
|
307
|
+
x: number;
|
|
308
|
+
y: number;
|
|
309
|
+
t: number;
|
|
310
|
+
}[]): number;
|
|
311
|
+
_countDirectionChanges(positions: {
|
|
312
|
+
x: number;
|
|
313
|
+
y: number;
|
|
314
|
+
t: number;
|
|
315
|
+
}[]): number;
|
|
316
|
+
_variance(arr: number[]): number;
|
|
317
|
+
_getEmptyAnalysis(): Record<string, unknown>;
|
|
318
|
+
_getEmptyClickAnalysis(): Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
declare class EnvironmentalCollector {
|
|
322
|
+
collect(): Record<string, unknown>;
|
|
323
|
+
collectAsync(): Promise<Record<string, unknown>>;
|
|
324
|
+
_detectWebdriver(): boolean;
|
|
325
|
+
_getAutomationFlags(): Record<string, unknown>;
|
|
326
|
+
_detectPlaywright(): {
|
|
327
|
+
detected: boolean;
|
|
328
|
+
signals: string[];
|
|
329
|
+
};
|
|
330
|
+
_detectCDP(): {
|
|
331
|
+
detected: boolean;
|
|
332
|
+
signals: string[];
|
|
333
|
+
};
|
|
334
|
+
_getCanvasHash(): Record<string, unknown>;
|
|
335
|
+
_getWebGLInfo(): Record<string, unknown>;
|
|
336
|
+
_getAudioInfo(): Record<string, unknown>;
|
|
337
|
+
_getHeadlessIndicators(): Record<string, unknown>;
|
|
338
|
+
_getScreenInfo(): Record<string, unknown>;
|
|
339
|
+
_getNavigatorInfo(): Record<string, unknown>;
|
|
340
|
+
_measureJSExecution(): Record<string, number>;
|
|
341
|
+
measureRAFConsistency(): Promise<Record<string, unknown>>;
|
|
342
|
+
/**
|
|
343
|
+
* Math fingerprint - Different JS engines produce slightly different results
|
|
344
|
+
* for certain math operations. Headless browsers/VMs may show inconsistencies.
|
|
345
|
+
*/
|
|
346
|
+
_getMathFingerprint(): Record<string, unknown>;
|
|
347
|
+
/**
|
|
348
|
+
* Error fingerprint - Error message formatting varies by engine
|
|
349
|
+
* Uses safe error triggers (no eval/Function) to get engine-specific messages
|
|
350
|
+
*/
|
|
351
|
+
_getErrorFingerprint(): Record<string, unknown>;
|
|
352
|
+
/**
|
|
353
|
+
* DOMRect fingerprint - Element rendering varies slightly between browsers/configs
|
|
354
|
+
*/
|
|
355
|
+
_getDOMRectFingerprint(): Record<string, unknown>;
|
|
356
|
+
/**
|
|
357
|
+
* CSS Media Queries - Detect screen/device characteristics
|
|
358
|
+
*/
|
|
359
|
+
_getCSSMediaQueries(): Record<string, unknown>;
|
|
360
|
+
/**
|
|
361
|
+
* Permissions API - Check browser permission states
|
|
362
|
+
*/
|
|
363
|
+
_getPermissionsInfo(): Record<string, unknown>;
|
|
364
|
+
/**
|
|
365
|
+
* Font detection - Check for system fonts
|
|
366
|
+
* Uses canvas-based detection (fast, doesn't require font loading)
|
|
367
|
+
*/
|
|
368
|
+
_getFontsInfo(): Record<string, unknown>;
|
|
369
|
+
/**
|
|
370
|
+
* Speech Synthesis API - Get available voices
|
|
371
|
+
* Voices are OS/browser specific and hard to spoof
|
|
372
|
+
*/
|
|
373
|
+
_getSpeechInfo(): Promise<Record<string, unknown>>;
|
|
374
|
+
/**
|
|
375
|
+
* WebRTC fingerprinting - Get local IPs and media devices
|
|
376
|
+
* Very effective for detecting VMs, proxies, and headless browsers
|
|
377
|
+
*/
|
|
378
|
+
_getWebRTCInfo(): Promise<Record<string, unknown>>;
|
|
379
|
+
/**
|
|
380
|
+
* Worker consistency check - Compare main thread vs worker values
|
|
381
|
+
* Spoofed values often don't match between contexts
|
|
382
|
+
*/
|
|
383
|
+
_checkWorkerConsistency(): Promise<Record<string, unknown>>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface MotionRecord {
|
|
387
|
+
x: number;
|
|
388
|
+
y: number;
|
|
389
|
+
z: number;
|
|
390
|
+
t: number;
|
|
391
|
+
}
|
|
392
|
+
interface OrientationRecord {
|
|
393
|
+
alpha: number;
|
|
394
|
+
beta: number;
|
|
395
|
+
gamma: number;
|
|
396
|
+
t: number;
|
|
397
|
+
}
|
|
398
|
+
interface SensorAnalysis {
|
|
399
|
+
motionEventCount: number;
|
|
400
|
+
motionAccelAvg: number;
|
|
401
|
+
motionAccelVariance: number;
|
|
402
|
+
orientationEventCount: number;
|
|
403
|
+
orientationVariance: number;
|
|
404
|
+
hasSensorSupport: boolean;
|
|
405
|
+
}
|
|
406
|
+
declare class SensorCollector {
|
|
407
|
+
motionEvents: MotionRecord[];
|
|
408
|
+
orientationEvents: OrientationRecord[];
|
|
409
|
+
private _motionHandler;
|
|
410
|
+
private _orientationHandler;
|
|
411
|
+
private _attached;
|
|
412
|
+
constructor();
|
|
413
|
+
attach(): void;
|
|
414
|
+
detach(): void;
|
|
415
|
+
_recordMotion(e: DeviceMotionEvent): void;
|
|
416
|
+
_recordOrientation(e: DeviceOrientationEvent): void;
|
|
417
|
+
analyze(): SensorAnalysis;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
interface EventLogEntry {
|
|
421
|
+
type: string;
|
|
422
|
+
time: number;
|
|
423
|
+
target: string;
|
|
424
|
+
}
|
|
425
|
+
interface TextareaStats {
|
|
426
|
+
keydowns: number[];
|
|
427
|
+
keyups: number[];
|
|
428
|
+
intervals: number[];
|
|
429
|
+
lastKeyTime: number | null;
|
|
430
|
+
inputWithoutKey: number;
|
|
431
|
+
pasteCount: number;
|
|
432
|
+
dwellTimes: number[];
|
|
433
|
+
rollovers: number;
|
|
434
|
+
activeKeyCount: number;
|
|
435
|
+
pendingKeydowns: number[];
|
|
436
|
+
}
|
|
437
|
+
interface SubmitData {
|
|
438
|
+
method: string;
|
|
439
|
+
time?: number;
|
|
440
|
+
timeSincePageLoad?: number;
|
|
441
|
+
timeSinceFirstInteraction?: number | null;
|
|
442
|
+
timeSinceLastInteraction?: number | null;
|
|
443
|
+
eventsBeforeSubmit: number;
|
|
444
|
+
hadTriggerEvent: boolean;
|
|
445
|
+
}
|
|
446
|
+
declare class FormAnalyzer {
|
|
447
|
+
pageLoadTime: number;
|
|
448
|
+
firstInteractionTime: number | null;
|
|
449
|
+
lastInteractionTime: number | null;
|
|
450
|
+
totalEvents: number;
|
|
451
|
+
eventLog: EventLogEntry[];
|
|
452
|
+
textareaStats: Map<string, TextareaStats>;
|
|
453
|
+
submitData: SubmitData | null;
|
|
454
|
+
constructor();
|
|
455
|
+
_setupListeners(): void;
|
|
456
|
+
_recordInteraction(e: Event): void;
|
|
457
|
+
_recordTextareaKey(e: KeyboardEvent): void;
|
|
458
|
+
_interceptFormSubmit(): void;
|
|
459
|
+
_recordProgrammaticSubmit(_form: HTMLFormElement): void;
|
|
460
|
+
_recordSubmit(_e: SubmitEvent): void;
|
|
461
|
+
analyze(): Record<string, unknown>;
|
|
462
|
+
recordPaste(e: ClipboardEvent): void;
|
|
463
|
+
}
|
|
464
|
+
declare function getFormAnalyzer(): FormAnalyzer;
|
|
465
|
+
|
|
466
|
+
/** Async SHA-256 hex digest via the Web Crypto API. */
|
|
467
|
+
declare function sha256(message: string): Promise<string>;
|
|
468
|
+
|
|
469
|
+
export { BehavioralCollector, CaptchaWidget, type Challenge, type CollectedSignals, EnvironmentalCollector, FormAnalyzer, type InvisibleOptions, InvisibleSession, PoWManager, type PoWSolution, SensorCollector, TemporalCollector, type VerifyResponse, WebDecoyCaptcha, type WebDecoyCaptchaAPI, type WidgetOptions, getFormAnalyzer, getPoWManager, sha256 };
|