@keverdjs/fraud-sdk-angular 1.0.0 → 1.1.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/dist/index.d.mts CHANGED
@@ -1,60 +1,195 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { ModuleWithProviders } from '@angular/core';
2
3
 
3
4
  /**
4
- * Types for Angular SDK
5
- * TODO: Copy and adapt types from React SDK
5
+ * Keverd Fraud SDK Angular - Type Definitions
6
6
  */
7
- interface KeverdConfig {
8
- apiKey: string;
9
- endpoint?: string;
10
- }
11
- interface KeverdLoadOptions {
12
- apiKey: string;
13
- endpoint?: string;
7
+ interface KeverdDeviceInfo {
8
+ deviceId: string;
9
+ fingerprint: string;
10
+ manufacturer?: string;
11
+ model?: string;
12
+ brand?: string;
13
+ device?: string;
14
+ product?: string;
15
+ hardware?: string;
16
+ sdkVersion?: string;
17
+ osVersion?: string;
18
+ screenWidth?: string;
19
+ screenHeight?: string;
20
+ screenDensity?: string;
21
+ locale?: string;
22
+ timezone: string;
14
23
  }
15
- interface KeverdVisitorData {
24
+ interface KeverdSessionInfo {
25
+ sessionId?: string;
26
+ installId?: string;
27
+ sessionCount?: string;
28
+ firstSession?: string;
29
+ timestamp?: string;
16
30
  }
17
- interface KeverdVisitorDataOptions {
31
+ interface KeverdBehavioralSequence {
32
+ featureNames: string[];
33
+ windowSize: number;
34
+ maskValue: number;
35
+ sequence: number[][];
18
36
  }
19
- interface KeverdVisitorDataResult {
37
+ interface KeverdBehavioralData {
38
+ typing_dwell_ms?: number[];
39
+ typing_flight_ms?: number[];
40
+ swipe_velocity?: number;
41
+ session_entropy?: number;
42
+ suspicious_swipe_velocity?: number;
43
+ behavioral_vectors?: KeverdBehavioralSequence;
20
44
  }
21
45
  interface KeverdFingerprintRequest {
46
+ userId?: string;
47
+ device: KeverdDeviceInfo;
48
+ session?: KeverdSessionInfo;
49
+ behavioral?: KeverdBehavioralData;
50
+ }
51
+ interface KeverdSimSwapEngine {
52
+ userId?: string;
53
+ risk: number;
54
+ flags: {
55
+ sim_changed?: boolean;
56
+ device_changed?: boolean;
57
+ behavior_anomaly?: boolean;
58
+ time_anomaly?: boolean;
59
+ velocity_anomaly?: boolean;
60
+ };
61
+ updatedProfile?: Record<string, unknown>;
22
62
  }
23
63
  interface KeverdFingerprintResponse {
64
+ risk_score: number;
65
+ score: number;
66
+ action: 'allow' | 'soft_challenge' | 'hard_challenge' | 'block';
67
+ reason: string[];
68
+ session_id: string;
69
+ requestId: string;
70
+ sim_swap_engine?: KeverdSimSwapEngine;
24
71
  }
25
- interface KeverdDeviceInfo {
72
+ interface KeverdPrivacySignals {
73
+ isIncognito?: boolean;
74
+ isVPN?: boolean;
75
+ isAutomated?: boolean;
76
+ hasAdBlocker?: boolean;
26
77
  }
27
- interface KeverdSessionInfo {
78
+ interface KeverdVisitorData {
79
+ visitorId: string;
80
+ riskScore: number;
81
+ score: number;
82
+ action: 'allow' | 'soft_challenge' | 'hard_challenge' | 'block';
83
+ reasons: string[];
84
+ sessionId: string;
85
+ requestId: string;
86
+ simSwapEngine?: KeverdSimSwapEngine;
87
+ confidence?: number;
88
+ fingerprintjsVisitorId?: string;
89
+ privacySignals?: KeverdPrivacySignals;
90
+ deviceMatch?: boolean;
91
+ fraudProbability?: number;
92
+ recommendedAction?: string;
28
93
  }
29
- interface KeverdBehavioralData {
94
+ interface KeverdConfig {
95
+ apiKey: string;
96
+ endpoint?: string;
97
+ userId?: string;
98
+ debug?: boolean;
99
+ extendedResult?: boolean;
100
+ ignoreCache?: boolean;
101
+ }
102
+ interface KeverdLoadOptions {
103
+ apiKey: string;
104
+ endpoint?: string;
105
+ debug?: boolean;
106
+ }
107
+ interface KeverdVisitorDataOptions {
108
+ extendedResult?: boolean;
109
+ ignoreCache?: boolean;
110
+ tag?: string;
30
111
  }
31
112
  interface KeverdError {
113
+ message: string;
114
+ code?: string;
115
+ statusCode?: number;
32
116
  }
33
117
 
34
118
  /**
35
119
  * Angular service for Keverd SDK
36
- * TODO: Implement Angular service
120
+ * Provides RxJS observables for reactive data access
121
+ * Wraps the web SDK to provide Angular-specific interface with all enhanced signals
37
122
  */
38
123
 
39
124
  declare class KeverdService {
40
125
  private config;
126
+ private isInitialized;
127
+ constructor(config?: KeverdConfig);
128
+ /**
129
+ * Initialize the SDK with configuration
130
+ * Wraps the web SDK initialization
131
+ */
41
132
  init(config: KeverdConfig): void;
133
+ /**
134
+ * Get visitor data (fingerprint and risk assessment)
135
+ * Returns an RxJS Observable
136
+ */
42
137
  getVisitorData(options?: KeverdVisitorDataOptions): Observable<KeverdVisitorData>;
138
+ /**
139
+ * Collect data and send fingerprint request
140
+ * Uses the web SDK which includes all enhanced signals including FingerprintJS
141
+ */
142
+ private collectAndSendFingerprint;
143
+ /**
144
+ * Transform API response to visitor data format
145
+ */
146
+ private transformResponse;
147
+ /**
148
+ * Get default endpoint
149
+ */
150
+ private getDefaultEndpoint;
151
+ /**
152
+ * Generate a session ID
153
+ */
154
+ private generateSessionId;
155
+ /**
156
+ * Destroy the SDK instance
157
+ */
158
+ destroy(): void;
159
+ /**
160
+ * Get current configuration
161
+ */
162
+ getConfig(): KeverdConfig | null;
163
+ /**
164
+ * Check if SDK is initialized
165
+ */
166
+ isReady(): boolean;
43
167
  }
44
168
 
45
169
  /**
46
170
  * Angular module for Keverd SDK
47
- * TODO: Implement Angular module
171
+ * Provides module configuration for easy setup
48
172
  */
49
173
 
50
174
  declare class KeverdModule {
51
- static forRoot(config: any): {
52
- ngModule: typeof KeverdModule;
53
- providers: (typeof KeverdService | {
54
- provide: string;
55
- useValue: any;
56
- })[];
57
- };
175
+ /**
176
+ * Configure the module with SDK settings
177
+ * Call this in your app.module.ts imports array
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * @NgModule({
182
+ * imports: [
183
+ * KeverdModule.forRoot({
184
+ * apiKey: 'your-api-key',
185
+ * endpoint: 'https://api.keverd.com'
186
+ * })
187
+ * ]
188
+ * })
189
+ * export class AppModule {}
190
+ * ```
191
+ */
192
+ static forRoot(config: KeverdConfig): ModuleWithProviders<KeverdModule>;
58
193
  }
59
194
 
60
- export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions, type KeverdVisitorDataResult };
195
+ export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions };
package/dist/index.d.ts CHANGED
@@ -1,60 +1,195 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { ModuleWithProviders } from '@angular/core';
2
3
 
3
4
  /**
4
- * Types for Angular SDK
5
- * TODO: Copy and adapt types from React SDK
5
+ * Keverd Fraud SDK Angular - Type Definitions
6
6
  */
7
- interface KeverdConfig {
8
- apiKey: string;
9
- endpoint?: string;
10
- }
11
- interface KeverdLoadOptions {
12
- apiKey: string;
13
- endpoint?: string;
7
+ interface KeverdDeviceInfo {
8
+ deviceId: string;
9
+ fingerprint: string;
10
+ manufacturer?: string;
11
+ model?: string;
12
+ brand?: string;
13
+ device?: string;
14
+ product?: string;
15
+ hardware?: string;
16
+ sdkVersion?: string;
17
+ osVersion?: string;
18
+ screenWidth?: string;
19
+ screenHeight?: string;
20
+ screenDensity?: string;
21
+ locale?: string;
22
+ timezone: string;
14
23
  }
15
- interface KeverdVisitorData {
24
+ interface KeverdSessionInfo {
25
+ sessionId?: string;
26
+ installId?: string;
27
+ sessionCount?: string;
28
+ firstSession?: string;
29
+ timestamp?: string;
16
30
  }
17
- interface KeverdVisitorDataOptions {
31
+ interface KeverdBehavioralSequence {
32
+ featureNames: string[];
33
+ windowSize: number;
34
+ maskValue: number;
35
+ sequence: number[][];
18
36
  }
19
- interface KeverdVisitorDataResult {
37
+ interface KeverdBehavioralData {
38
+ typing_dwell_ms?: number[];
39
+ typing_flight_ms?: number[];
40
+ swipe_velocity?: number;
41
+ session_entropy?: number;
42
+ suspicious_swipe_velocity?: number;
43
+ behavioral_vectors?: KeverdBehavioralSequence;
20
44
  }
21
45
  interface KeverdFingerprintRequest {
46
+ userId?: string;
47
+ device: KeverdDeviceInfo;
48
+ session?: KeverdSessionInfo;
49
+ behavioral?: KeverdBehavioralData;
50
+ }
51
+ interface KeverdSimSwapEngine {
52
+ userId?: string;
53
+ risk: number;
54
+ flags: {
55
+ sim_changed?: boolean;
56
+ device_changed?: boolean;
57
+ behavior_anomaly?: boolean;
58
+ time_anomaly?: boolean;
59
+ velocity_anomaly?: boolean;
60
+ };
61
+ updatedProfile?: Record<string, unknown>;
22
62
  }
23
63
  interface KeverdFingerprintResponse {
64
+ risk_score: number;
65
+ score: number;
66
+ action: 'allow' | 'soft_challenge' | 'hard_challenge' | 'block';
67
+ reason: string[];
68
+ session_id: string;
69
+ requestId: string;
70
+ sim_swap_engine?: KeverdSimSwapEngine;
24
71
  }
25
- interface KeverdDeviceInfo {
72
+ interface KeverdPrivacySignals {
73
+ isIncognito?: boolean;
74
+ isVPN?: boolean;
75
+ isAutomated?: boolean;
76
+ hasAdBlocker?: boolean;
26
77
  }
27
- interface KeverdSessionInfo {
78
+ interface KeverdVisitorData {
79
+ visitorId: string;
80
+ riskScore: number;
81
+ score: number;
82
+ action: 'allow' | 'soft_challenge' | 'hard_challenge' | 'block';
83
+ reasons: string[];
84
+ sessionId: string;
85
+ requestId: string;
86
+ simSwapEngine?: KeverdSimSwapEngine;
87
+ confidence?: number;
88
+ fingerprintjsVisitorId?: string;
89
+ privacySignals?: KeverdPrivacySignals;
90
+ deviceMatch?: boolean;
91
+ fraudProbability?: number;
92
+ recommendedAction?: string;
28
93
  }
29
- interface KeverdBehavioralData {
94
+ interface KeverdConfig {
95
+ apiKey: string;
96
+ endpoint?: string;
97
+ userId?: string;
98
+ debug?: boolean;
99
+ extendedResult?: boolean;
100
+ ignoreCache?: boolean;
101
+ }
102
+ interface KeverdLoadOptions {
103
+ apiKey: string;
104
+ endpoint?: string;
105
+ debug?: boolean;
106
+ }
107
+ interface KeverdVisitorDataOptions {
108
+ extendedResult?: boolean;
109
+ ignoreCache?: boolean;
110
+ tag?: string;
30
111
  }
31
112
  interface KeverdError {
113
+ message: string;
114
+ code?: string;
115
+ statusCode?: number;
32
116
  }
33
117
 
34
118
  /**
35
119
  * Angular service for Keverd SDK
36
- * TODO: Implement Angular service
120
+ * Provides RxJS observables for reactive data access
121
+ * Wraps the web SDK to provide Angular-specific interface with all enhanced signals
37
122
  */
38
123
 
39
124
  declare class KeverdService {
40
125
  private config;
126
+ private isInitialized;
127
+ constructor(config?: KeverdConfig);
128
+ /**
129
+ * Initialize the SDK with configuration
130
+ * Wraps the web SDK initialization
131
+ */
41
132
  init(config: KeverdConfig): void;
133
+ /**
134
+ * Get visitor data (fingerprint and risk assessment)
135
+ * Returns an RxJS Observable
136
+ */
42
137
  getVisitorData(options?: KeverdVisitorDataOptions): Observable<KeverdVisitorData>;
138
+ /**
139
+ * Collect data and send fingerprint request
140
+ * Uses the web SDK which includes all enhanced signals including FingerprintJS
141
+ */
142
+ private collectAndSendFingerprint;
143
+ /**
144
+ * Transform API response to visitor data format
145
+ */
146
+ private transformResponse;
147
+ /**
148
+ * Get default endpoint
149
+ */
150
+ private getDefaultEndpoint;
151
+ /**
152
+ * Generate a session ID
153
+ */
154
+ private generateSessionId;
155
+ /**
156
+ * Destroy the SDK instance
157
+ */
158
+ destroy(): void;
159
+ /**
160
+ * Get current configuration
161
+ */
162
+ getConfig(): KeverdConfig | null;
163
+ /**
164
+ * Check if SDK is initialized
165
+ */
166
+ isReady(): boolean;
43
167
  }
44
168
 
45
169
  /**
46
170
  * Angular module for Keverd SDK
47
- * TODO: Implement Angular module
171
+ * Provides module configuration for easy setup
48
172
  */
49
173
 
50
174
  declare class KeverdModule {
51
- static forRoot(config: any): {
52
- ngModule: typeof KeverdModule;
53
- providers: (typeof KeverdService | {
54
- provide: string;
55
- useValue: any;
56
- })[];
57
- };
175
+ /**
176
+ * Configure the module with SDK settings
177
+ * Call this in your app.module.ts imports array
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * @NgModule({
182
+ * imports: [
183
+ * KeverdModule.forRoot({
184
+ * apiKey: 'your-api-key',
185
+ * endpoint: 'https://api.keverd.com'
186
+ * })
187
+ * ]
188
+ * })
189
+ * export class AppModule {}
190
+ * ```
191
+ */
192
+ static forRoot(config: KeverdConfig): ModuleWithProviders<KeverdModule>;
58
193
  }
59
194
 
60
- export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions, type KeverdVisitorDataResult };
195
+ export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions };