@keverdjs/fraud-sdk-react 1.0.0 → 2.0.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 +0 -16
- package/dist/index.d.mts +49 -62
- package/dist/index.d.ts +49 -62
- package/dist/index.js +536 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +536 -221
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -85,7 +85,6 @@ interface KeverdProviderProps {
|
|
|
85
85
|
```typescript
|
|
86
86
|
interface KeverdLoadOptions {
|
|
87
87
|
apiKey: string; // Required: Your Keverd API key
|
|
88
|
-
endpoint?: string; // Optional: Custom API endpoint (default: https://app.keverd.com)
|
|
89
88
|
debug?: boolean; // Optional: Enable debug logging (default: false)
|
|
90
89
|
}
|
|
91
90
|
```
|
|
@@ -151,21 +150,6 @@ const sdk = useKeverdContext();
|
|
|
151
150
|
|
|
152
151
|
## Configuration
|
|
153
152
|
|
|
154
|
-
### Custom Endpoint
|
|
155
|
-
|
|
156
|
-
If you're using a custom backend endpoint:
|
|
157
|
-
|
|
158
|
-
```tsx
|
|
159
|
-
<KeverdProvider
|
|
160
|
-
loadOptions={{
|
|
161
|
-
apiKey: 'your-api-key',
|
|
162
|
-
endpoint: 'https://api.yourdomain.com/v1/fingerprint/score',
|
|
163
|
-
}}
|
|
164
|
-
>
|
|
165
|
-
{children}
|
|
166
|
-
</KeverdProvider>
|
|
167
|
-
```
|
|
168
|
-
|
|
169
153
|
### Debug Mode
|
|
170
154
|
|
|
171
155
|
Enable debug logging for development:
|
package/dist/index.d.mts
CHANGED
|
@@ -28,11 +28,19 @@ interface KeverdSessionInfo {
|
|
|
28
28
|
firstSession?: string;
|
|
29
29
|
timestamp?: string;
|
|
30
30
|
}
|
|
31
|
+
interface KeverdBehavioralSequence {
|
|
32
|
+
featureNames: string[];
|
|
33
|
+
windowSize: number;
|
|
34
|
+
maskValue: number;
|
|
35
|
+
sequence: number[][];
|
|
36
|
+
}
|
|
31
37
|
interface KeverdBehavioralData {
|
|
32
38
|
typing_dwell_ms?: number[];
|
|
33
39
|
typing_flight_ms?: number[];
|
|
34
40
|
swipe_velocity?: number;
|
|
35
41
|
session_entropy?: number;
|
|
42
|
+
suspicious_swipe_velocity?: number;
|
|
43
|
+
behavioral_vectors?: KeverdBehavioralSequence;
|
|
36
44
|
}
|
|
37
45
|
interface KeverdFingerprintRequest {
|
|
38
46
|
userId?: string;
|
|
@@ -74,7 +82,6 @@ interface KeverdVisitorData {
|
|
|
74
82
|
}
|
|
75
83
|
interface KeverdConfig {
|
|
76
84
|
apiKey: string;
|
|
77
|
-
endpoint?: string;
|
|
78
85
|
userId?: string;
|
|
79
86
|
debug?: boolean;
|
|
80
87
|
extendedResult?: boolean;
|
|
@@ -82,7 +89,6 @@ interface KeverdConfig {
|
|
|
82
89
|
}
|
|
83
90
|
interface KeverdLoadOptions {
|
|
84
91
|
apiKey: string;
|
|
85
|
-
endpoint?: string;
|
|
86
92
|
debug?: boolean;
|
|
87
93
|
}
|
|
88
94
|
interface KeverdVisitorDataOptions {
|
|
@@ -143,10 +149,44 @@ declare class KeverdSDK {
|
|
|
143
149
|
* Generate a session ID
|
|
144
150
|
*/
|
|
145
151
|
private generateSessionId;
|
|
152
|
+
/**
|
|
153
|
+
* Start a new session (called automatically on init, but can be called manually)
|
|
154
|
+
*/
|
|
155
|
+
startSession(userId?: string, deviceHash?: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* End the current session
|
|
158
|
+
*/
|
|
159
|
+
endSession(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Pause the current session (e.g., when app goes to background)
|
|
162
|
+
*/
|
|
163
|
+
pauseSession(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Resume a paused session (e.g., when app comes to foreground)
|
|
166
|
+
*/
|
|
167
|
+
resumeSession(): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Get current session status
|
|
170
|
+
*/
|
|
171
|
+
getSessionStatus(): Promise<{
|
|
172
|
+
session_id: string;
|
|
173
|
+
status: string;
|
|
174
|
+
is_active: boolean;
|
|
175
|
+
is_paused: boolean;
|
|
176
|
+
event_count: number;
|
|
177
|
+
started_at: string;
|
|
178
|
+
last_activity_at: string;
|
|
179
|
+
duration_seconds: number | null;
|
|
180
|
+
} | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Helper methods for browser/OS detection
|
|
183
|
+
*/
|
|
184
|
+
private _detectBrowser;
|
|
185
|
+
private _detectOS;
|
|
146
186
|
/**
|
|
147
187
|
* Destroy the SDK instance
|
|
148
188
|
*/
|
|
149
|
-
destroy(): void
|
|
189
|
+
destroy(): Promise<void>;
|
|
150
190
|
/**
|
|
151
191
|
* Get current configuration
|
|
152
192
|
*/
|
|
@@ -294,72 +334,19 @@ declare class KeverdDeviceCollector {
|
|
|
294
334
|
clearCache(): void;
|
|
295
335
|
}
|
|
296
336
|
|
|
297
|
-
/**
|
|
298
|
-
* Keverd Behavioral Data Collector
|
|
299
|
-
* Collects typing patterns, mouse movements, swipe gestures, and calculates session entropy
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
337
|
declare class KeverdBehavioralCollector {
|
|
303
|
-
private keystrokes;
|
|
304
|
-
private mouseMovements;
|
|
305
|
-
private lastKeyDownTime;
|
|
306
|
-
private lastKeyUpTime;
|
|
307
338
|
private isActive;
|
|
308
|
-
private sessionStartTime;
|
|
309
|
-
private typingDwellTimes;
|
|
310
|
-
private typingFlightTimes;
|
|
311
|
-
private swipeVelocities;
|
|
312
339
|
private sessionEvents;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
|
|
316
|
-
private mouseMoveHandler;
|
|
317
|
-
private touchStartHandler;
|
|
318
|
-
private touchEndHandler;
|
|
319
|
-
/**
|
|
320
|
-
* Start collecting behavioral data
|
|
321
|
-
*/
|
|
340
|
+
private kinematicEngine;
|
|
341
|
+
private keystrokeMonitor;
|
|
342
|
+
constructor();
|
|
322
343
|
start(): void;
|
|
323
|
-
/**
|
|
324
|
-
* Stop collecting behavioral data
|
|
325
|
-
*/
|
|
326
344
|
stop(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Get collected behavioral data
|
|
329
|
-
*/
|
|
330
|
-
getData(): KeverdBehavioralData;
|
|
331
|
-
/**
|
|
332
|
-
* Reset collected data
|
|
333
|
-
*/
|
|
334
345
|
reset(): void;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
private handleKeyDown;
|
|
339
|
-
/**
|
|
340
|
-
* Handle keyup event
|
|
341
|
-
*/
|
|
342
|
-
private handleKeyUp;
|
|
343
|
-
/**
|
|
344
|
-
* Handle mouse move event
|
|
345
|
-
*/
|
|
346
|
-
private handleMouseMove;
|
|
347
|
-
/**
|
|
348
|
-
* Handle touch start (for swipe detection)
|
|
349
|
-
*/
|
|
350
|
-
private handleTouchStart;
|
|
351
|
-
/**
|
|
352
|
-
* Handle touch end (calculate swipe velocity)
|
|
353
|
-
*/
|
|
354
|
-
private handleTouchEnd;
|
|
355
|
-
/**
|
|
356
|
-
* Calculate session entropy based on event diversity
|
|
357
|
-
*/
|
|
346
|
+
getData(): KeverdBehavioralData;
|
|
347
|
+
private buildSequence;
|
|
348
|
+
private trackEvent;
|
|
358
349
|
private calculateSessionEntropy;
|
|
359
|
-
/**
|
|
360
|
-
* Check if key should be ignored
|
|
361
|
-
*/
|
|
362
|
-
private shouldIgnoreKey;
|
|
363
350
|
}
|
|
364
351
|
|
|
365
352
|
export { KeverdBehavioralCollector, type KeverdBehavioralData, type KeverdConfig, KeverdDeviceCollector, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdProvider, KeverdSDK, type KeverdSessionInfo, type KeverdSimSwapEngine, type KeverdVisitorData, type KeverdVisitorDataHookOptions, type KeverdVisitorDataOptions, type KeverdVisitorDataResult$1 as KeverdVisitorDataResult, useKeverdContext, useKeverdVisitorData };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,11 +28,19 @@ interface KeverdSessionInfo {
|
|
|
28
28
|
firstSession?: string;
|
|
29
29
|
timestamp?: string;
|
|
30
30
|
}
|
|
31
|
+
interface KeverdBehavioralSequence {
|
|
32
|
+
featureNames: string[];
|
|
33
|
+
windowSize: number;
|
|
34
|
+
maskValue: number;
|
|
35
|
+
sequence: number[][];
|
|
36
|
+
}
|
|
31
37
|
interface KeverdBehavioralData {
|
|
32
38
|
typing_dwell_ms?: number[];
|
|
33
39
|
typing_flight_ms?: number[];
|
|
34
40
|
swipe_velocity?: number;
|
|
35
41
|
session_entropy?: number;
|
|
42
|
+
suspicious_swipe_velocity?: number;
|
|
43
|
+
behavioral_vectors?: KeverdBehavioralSequence;
|
|
36
44
|
}
|
|
37
45
|
interface KeverdFingerprintRequest {
|
|
38
46
|
userId?: string;
|
|
@@ -74,7 +82,6 @@ interface KeverdVisitorData {
|
|
|
74
82
|
}
|
|
75
83
|
interface KeverdConfig {
|
|
76
84
|
apiKey: string;
|
|
77
|
-
endpoint?: string;
|
|
78
85
|
userId?: string;
|
|
79
86
|
debug?: boolean;
|
|
80
87
|
extendedResult?: boolean;
|
|
@@ -82,7 +89,6 @@ interface KeverdConfig {
|
|
|
82
89
|
}
|
|
83
90
|
interface KeverdLoadOptions {
|
|
84
91
|
apiKey: string;
|
|
85
|
-
endpoint?: string;
|
|
86
92
|
debug?: boolean;
|
|
87
93
|
}
|
|
88
94
|
interface KeverdVisitorDataOptions {
|
|
@@ -143,10 +149,44 @@ declare class KeverdSDK {
|
|
|
143
149
|
* Generate a session ID
|
|
144
150
|
*/
|
|
145
151
|
private generateSessionId;
|
|
152
|
+
/**
|
|
153
|
+
* Start a new session (called automatically on init, but can be called manually)
|
|
154
|
+
*/
|
|
155
|
+
startSession(userId?: string, deviceHash?: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* End the current session
|
|
158
|
+
*/
|
|
159
|
+
endSession(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Pause the current session (e.g., when app goes to background)
|
|
162
|
+
*/
|
|
163
|
+
pauseSession(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Resume a paused session (e.g., when app comes to foreground)
|
|
166
|
+
*/
|
|
167
|
+
resumeSession(): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Get current session status
|
|
170
|
+
*/
|
|
171
|
+
getSessionStatus(): Promise<{
|
|
172
|
+
session_id: string;
|
|
173
|
+
status: string;
|
|
174
|
+
is_active: boolean;
|
|
175
|
+
is_paused: boolean;
|
|
176
|
+
event_count: number;
|
|
177
|
+
started_at: string;
|
|
178
|
+
last_activity_at: string;
|
|
179
|
+
duration_seconds: number | null;
|
|
180
|
+
} | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Helper methods for browser/OS detection
|
|
183
|
+
*/
|
|
184
|
+
private _detectBrowser;
|
|
185
|
+
private _detectOS;
|
|
146
186
|
/**
|
|
147
187
|
* Destroy the SDK instance
|
|
148
188
|
*/
|
|
149
|
-
destroy(): void
|
|
189
|
+
destroy(): Promise<void>;
|
|
150
190
|
/**
|
|
151
191
|
* Get current configuration
|
|
152
192
|
*/
|
|
@@ -294,72 +334,19 @@ declare class KeverdDeviceCollector {
|
|
|
294
334
|
clearCache(): void;
|
|
295
335
|
}
|
|
296
336
|
|
|
297
|
-
/**
|
|
298
|
-
* Keverd Behavioral Data Collector
|
|
299
|
-
* Collects typing patterns, mouse movements, swipe gestures, and calculates session entropy
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
337
|
declare class KeverdBehavioralCollector {
|
|
303
|
-
private keystrokes;
|
|
304
|
-
private mouseMovements;
|
|
305
|
-
private lastKeyDownTime;
|
|
306
|
-
private lastKeyUpTime;
|
|
307
338
|
private isActive;
|
|
308
|
-
private sessionStartTime;
|
|
309
|
-
private typingDwellTimes;
|
|
310
|
-
private typingFlightTimes;
|
|
311
|
-
private swipeVelocities;
|
|
312
339
|
private sessionEvents;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
|
|
316
|
-
private mouseMoveHandler;
|
|
317
|
-
private touchStartHandler;
|
|
318
|
-
private touchEndHandler;
|
|
319
|
-
/**
|
|
320
|
-
* Start collecting behavioral data
|
|
321
|
-
*/
|
|
340
|
+
private kinematicEngine;
|
|
341
|
+
private keystrokeMonitor;
|
|
342
|
+
constructor();
|
|
322
343
|
start(): void;
|
|
323
|
-
/**
|
|
324
|
-
* Stop collecting behavioral data
|
|
325
|
-
*/
|
|
326
344
|
stop(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Get collected behavioral data
|
|
329
|
-
*/
|
|
330
|
-
getData(): KeverdBehavioralData;
|
|
331
|
-
/**
|
|
332
|
-
* Reset collected data
|
|
333
|
-
*/
|
|
334
345
|
reset(): void;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
private handleKeyDown;
|
|
339
|
-
/**
|
|
340
|
-
* Handle keyup event
|
|
341
|
-
*/
|
|
342
|
-
private handleKeyUp;
|
|
343
|
-
/**
|
|
344
|
-
* Handle mouse move event
|
|
345
|
-
*/
|
|
346
|
-
private handleMouseMove;
|
|
347
|
-
/**
|
|
348
|
-
* Handle touch start (for swipe detection)
|
|
349
|
-
*/
|
|
350
|
-
private handleTouchStart;
|
|
351
|
-
/**
|
|
352
|
-
* Handle touch end (calculate swipe velocity)
|
|
353
|
-
*/
|
|
354
|
-
private handleTouchEnd;
|
|
355
|
-
/**
|
|
356
|
-
* Calculate session entropy based on event diversity
|
|
357
|
-
*/
|
|
346
|
+
getData(): KeverdBehavioralData;
|
|
347
|
+
private buildSequence;
|
|
348
|
+
private trackEvent;
|
|
358
349
|
private calculateSessionEntropy;
|
|
359
|
-
/**
|
|
360
|
-
* Check if key should be ignored
|
|
361
|
-
*/
|
|
362
|
-
private shouldIgnoreKey;
|
|
363
350
|
}
|
|
364
351
|
|
|
365
352
|
export { KeverdBehavioralCollector, type KeverdBehavioralData, type KeverdConfig, KeverdDeviceCollector, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdProvider, KeverdSDK, type KeverdSessionInfo, type KeverdSimSwapEngine, type KeverdVisitorData, type KeverdVisitorDataHookOptions, type KeverdVisitorDataOptions, type KeverdVisitorDataResult$1 as KeverdVisitorDataResult, useKeverdContext, useKeverdVisitorData };
|