@keverdjs/fraud-sdk-react 1.0.0 → 1.1.2
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 +53 -62
- package/dist/index.d.ts +53 -62
- package/dist/index.js +554 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +554 -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 {
|
|
@@ -127,6 +133,10 @@ declare class KeverdSDK {
|
|
|
127
133
|
* Get visitor data (fingerprint and risk assessment)
|
|
128
134
|
*/
|
|
129
135
|
getVisitorData(options?: KeverdVisitorDataOptions): Promise<KeverdVisitorData>;
|
|
136
|
+
/**
|
|
137
|
+
* Extract origin and referrer from browser
|
|
138
|
+
*/
|
|
139
|
+
private getOriginHeaders;
|
|
130
140
|
/**
|
|
131
141
|
* Send fingerprint request to backend
|
|
132
142
|
*/
|
|
@@ -143,10 +153,44 @@ declare class KeverdSDK {
|
|
|
143
153
|
* Generate a session ID
|
|
144
154
|
*/
|
|
145
155
|
private generateSessionId;
|
|
156
|
+
/**
|
|
157
|
+
* Start a new session (called automatically on init, but can be called manually)
|
|
158
|
+
*/
|
|
159
|
+
startSession(userId?: string, deviceHash?: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* End the current session
|
|
162
|
+
*/
|
|
163
|
+
endSession(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Pause the current session (e.g., when app goes to background)
|
|
166
|
+
*/
|
|
167
|
+
pauseSession(): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Resume a paused session (e.g., when app comes to foreground)
|
|
170
|
+
*/
|
|
171
|
+
resumeSession(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Get current session status
|
|
174
|
+
*/
|
|
175
|
+
getSessionStatus(): Promise<{
|
|
176
|
+
session_id: string;
|
|
177
|
+
status: string;
|
|
178
|
+
is_active: boolean;
|
|
179
|
+
is_paused: boolean;
|
|
180
|
+
event_count: number;
|
|
181
|
+
started_at: string;
|
|
182
|
+
last_activity_at: string;
|
|
183
|
+
duration_seconds: number | null;
|
|
184
|
+
} | null>;
|
|
185
|
+
/**
|
|
186
|
+
* Helper methods for browser/OS detection
|
|
187
|
+
*/
|
|
188
|
+
private _detectBrowser;
|
|
189
|
+
private _detectOS;
|
|
146
190
|
/**
|
|
147
191
|
* Destroy the SDK instance
|
|
148
192
|
*/
|
|
149
|
-
destroy(): void
|
|
193
|
+
destroy(): Promise<void>;
|
|
150
194
|
/**
|
|
151
195
|
* Get current configuration
|
|
152
196
|
*/
|
|
@@ -294,72 +338,19 @@ declare class KeverdDeviceCollector {
|
|
|
294
338
|
clearCache(): void;
|
|
295
339
|
}
|
|
296
340
|
|
|
297
|
-
/**
|
|
298
|
-
* Keverd Behavioral Data Collector
|
|
299
|
-
* Collects typing patterns, mouse movements, swipe gestures, and calculates session entropy
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
341
|
declare class KeverdBehavioralCollector {
|
|
303
|
-
private keystrokes;
|
|
304
|
-
private mouseMovements;
|
|
305
|
-
private lastKeyDownTime;
|
|
306
|
-
private lastKeyUpTime;
|
|
307
342
|
private isActive;
|
|
308
|
-
private sessionStartTime;
|
|
309
|
-
private typingDwellTimes;
|
|
310
|
-
private typingFlightTimes;
|
|
311
|
-
private swipeVelocities;
|
|
312
343
|
private sessionEvents;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
|
|
316
|
-
private mouseMoveHandler;
|
|
317
|
-
private touchStartHandler;
|
|
318
|
-
private touchEndHandler;
|
|
319
|
-
/**
|
|
320
|
-
* Start collecting behavioral data
|
|
321
|
-
*/
|
|
344
|
+
private kinematicEngine;
|
|
345
|
+
private keystrokeMonitor;
|
|
346
|
+
constructor();
|
|
322
347
|
start(): void;
|
|
323
|
-
/**
|
|
324
|
-
* Stop collecting behavioral data
|
|
325
|
-
*/
|
|
326
348
|
stop(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Get collected behavioral data
|
|
329
|
-
*/
|
|
330
|
-
getData(): KeverdBehavioralData;
|
|
331
|
-
/**
|
|
332
|
-
* Reset collected data
|
|
333
|
-
*/
|
|
334
349
|
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
|
-
*/
|
|
350
|
+
getData(): KeverdBehavioralData;
|
|
351
|
+
private buildSequence;
|
|
352
|
+
private trackEvent;
|
|
358
353
|
private calculateSessionEntropy;
|
|
359
|
-
/**
|
|
360
|
-
* Check if key should be ignored
|
|
361
|
-
*/
|
|
362
|
-
private shouldIgnoreKey;
|
|
363
354
|
}
|
|
364
355
|
|
|
365
356
|
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 {
|
|
@@ -127,6 +133,10 @@ declare class KeverdSDK {
|
|
|
127
133
|
* Get visitor data (fingerprint and risk assessment)
|
|
128
134
|
*/
|
|
129
135
|
getVisitorData(options?: KeverdVisitorDataOptions): Promise<KeverdVisitorData>;
|
|
136
|
+
/**
|
|
137
|
+
* Extract origin and referrer from browser
|
|
138
|
+
*/
|
|
139
|
+
private getOriginHeaders;
|
|
130
140
|
/**
|
|
131
141
|
* Send fingerprint request to backend
|
|
132
142
|
*/
|
|
@@ -143,10 +153,44 @@ declare class KeverdSDK {
|
|
|
143
153
|
* Generate a session ID
|
|
144
154
|
*/
|
|
145
155
|
private generateSessionId;
|
|
156
|
+
/**
|
|
157
|
+
* Start a new session (called automatically on init, but can be called manually)
|
|
158
|
+
*/
|
|
159
|
+
startSession(userId?: string, deviceHash?: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* End the current session
|
|
162
|
+
*/
|
|
163
|
+
endSession(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Pause the current session (e.g., when app goes to background)
|
|
166
|
+
*/
|
|
167
|
+
pauseSession(): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Resume a paused session (e.g., when app comes to foreground)
|
|
170
|
+
*/
|
|
171
|
+
resumeSession(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Get current session status
|
|
174
|
+
*/
|
|
175
|
+
getSessionStatus(): Promise<{
|
|
176
|
+
session_id: string;
|
|
177
|
+
status: string;
|
|
178
|
+
is_active: boolean;
|
|
179
|
+
is_paused: boolean;
|
|
180
|
+
event_count: number;
|
|
181
|
+
started_at: string;
|
|
182
|
+
last_activity_at: string;
|
|
183
|
+
duration_seconds: number | null;
|
|
184
|
+
} | null>;
|
|
185
|
+
/**
|
|
186
|
+
* Helper methods for browser/OS detection
|
|
187
|
+
*/
|
|
188
|
+
private _detectBrowser;
|
|
189
|
+
private _detectOS;
|
|
146
190
|
/**
|
|
147
191
|
* Destroy the SDK instance
|
|
148
192
|
*/
|
|
149
|
-
destroy(): void
|
|
193
|
+
destroy(): Promise<void>;
|
|
150
194
|
/**
|
|
151
195
|
* Get current configuration
|
|
152
196
|
*/
|
|
@@ -294,72 +338,19 @@ declare class KeverdDeviceCollector {
|
|
|
294
338
|
clearCache(): void;
|
|
295
339
|
}
|
|
296
340
|
|
|
297
|
-
/**
|
|
298
|
-
* Keverd Behavioral Data Collector
|
|
299
|
-
* Collects typing patterns, mouse movements, swipe gestures, and calculates session entropy
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
341
|
declare class KeverdBehavioralCollector {
|
|
303
|
-
private keystrokes;
|
|
304
|
-
private mouseMovements;
|
|
305
|
-
private lastKeyDownTime;
|
|
306
|
-
private lastKeyUpTime;
|
|
307
342
|
private isActive;
|
|
308
|
-
private sessionStartTime;
|
|
309
|
-
private typingDwellTimes;
|
|
310
|
-
private typingFlightTimes;
|
|
311
|
-
private swipeVelocities;
|
|
312
343
|
private sessionEvents;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
|
|
316
|
-
private mouseMoveHandler;
|
|
317
|
-
private touchStartHandler;
|
|
318
|
-
private touchEndHandler;
|
|
319
|
-
/**
|
|
320
|
-
* Start collecting behavioral data
|
|
321
|
-
*/
|
|
344
|
+
private kinematicEngine;
|
|
345
|
+
private keystrokeMonitor;
|
|
346
|
+
constructor();
|
|
322
347
|
start(): void;
|
|
323
|
-
/**
|
|
324
|
-
* Stop collecting behavioral data
|
|
325
|
-
*/
|
|
326
348
|
stop(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Get collected behavioral data
|
|
329
|
-
*/
|
|
330
|
-
getData(): KeverdBehavioralData;
|
|
331
|
-
/**
|
|
332
|
-
* Reset collected data
|
|
333
|
-
*/
|
|
334
349
|
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
|
-
*/
|
|
350
|
+
getData(): KeverdBehavioralData;
|
|
351
|
+
private buildSequence;
|
|
352
|
+
private trackEvent;
|
|
358
353
|
private calculateSessionEntropy;
|
|
359
|
-
/**
|
|
360
|
-
* Check if key should be ignored
|
|
361
|
-
*/
|
|
362
|
-
private shouldIgnoreKey;
|
|
363
354
|
}
|
|
364
355
|
|
|
365
356
|
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 };
|