@keverdjs/fraud-sdk-angular 2.0.0 → 3.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 +13 -22
- package/dist/index.d.mts +88 -7
- package/dist/index.d.ts +88 -7
- package/dist/index.js +129 -3435
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -3426
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
# @keverdjs/fraud-sdk-angular
|
|
2
2
|
|
|
3
|
-
Angular SDK for Keverd
|
|
3
|
+
Angular SDK for Keverd persistent device intelligence.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @keverdjs/fraud-sdk-angular
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Quickstart
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```ts
|
|
14
|
+
import { Component } from '@angular/core';
|
|
14
15
|
import { KeverdService } from '@keverdjs/fraud-sdk-angular';
|
|
15
16
|
|
|
16
17
|
@Component({
|
|
17
18
|
selector: 'app-root',
|
|
18
19
|
template: `
|
|
19
20
|
<div *ngIf="loading">Loading...</div>
|
|
20
|
-
<div *ngIf="
|
|
21
|
-
|
|
22
|
-
`
|
|
21
|
+
<div *ngIf="riskScore !== null">Risk: {{ riskScore }}</div>
|
|
22
|
+
`,
|
|
23
23
|
})
|
|
24
24
|
export class AppComponent {
|
|
25
|
-
data: any;
|
|
26
25
|
loading = false;
|
|
27
|
-
|
|
26
|
+
riskScore: number | null = null;
|
|
28
27
|
|
|
29
|
-
constructor(private keverd: KeverdService) {
|
|
30
|
-
this.keverd.init({ apiKey: '
|
|
31
|
-
this.loadData();
|
|
28
|
+
constructor(private readonly keverd: KeverdService) {
|
|
29
|
+
this.keverd.init({ apiKey: 'YOUR_PUBLIC_API_KEY' });
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
async
|
|
32
|
+
async ngOnInit(): Promise<void> {
|
|
35
33
|
this.loading = true;
|
|
36
34
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.error = err;
|
|
35
|
+
const result = await this.keverd.getVisitorData();
|
|
36
|
+
this.riskScore = result.riskScore;
|
|
40
37
|
} finally {
|
|
41
38
|
this.loading = false;
|
|
42
39
|
}
|
|
@@ -44,9 +41,3 @@ export class AppComponent {
|
|
|
44
41
|
}
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
See the main [Keverd Fraud SDK Web README](../../README.md) for detailed documentation.
|
|
50
|
-
|
|
51
|
-
> **Note**: This package is currently under development.
|
|
52
|
-
|
package/dist/index.d.mts
CHANGED
|
@@ -61,12 +61,30 @@ interface KeverdSimSwapEngine {
|
|
|
61
61
|
updatedProfile?: Record<string, unknown>;
|
|
62
62
|
}
|
|
63
63
|
interface KeverdFingerprintResponse {
|
|
64
|
-
risk_score
|
|
65
|
-
score
|
|
66
|
-
action
|
|
67
|
-
reason
|
|
68
|
-
session_id
|
|
69
|
-
requestId
|
|
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
|
+
confidence?: number;
|
|
71
|
+
fingerprintjs_visitor_id?: string;
|
|
72
|
+
privacy_signals?: {
|
|
73
|
+
is_incognito?: boolean;
|
|
74
|
+
is_vpn?: boolean;
|
|
75
|
+
is_automated?: boolean;
|
|
76
|
+
has_ad_blocker?: boolean;
|
|
77
|
+
};
|
|
78
|
+
device_match?: boolean;
|
|
79
|
+
fraud_probability?: number;
|
|
80
|
+
recommended_action?: string;
|
|
81
|
+
adaptive_response?: {
|
|
82
|
+
recommended_action?: string;
|
|
83
|
+
challenges?: string[];
|
|
84
|
+
reason?: string;
|
|
85
|
+
confidence?: number;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
};
|
|
70
88
|
sim_swap_engine?: KeverdSimSwapEngine;
|
|
71
89
|
}
|
|
72
90
|
interface KeverdPrivacySignals {
|
|
@@ -90,6 +108,13 @@ interface KeverdVisitorData {
|
|
|
90
108
|
deviceMatch?: boolean;
|
|
91
109
|
fraudProbability?: number;
|
|
92
110
|
recommendedAction?: string;
|
|
111
|
+
adaptiveResponse?: {
|
|
112
|
+
recommendedAction?: string;
|
|
113
|
+
challenges?: string[];
|
|
114
|
+
reason?: string;
|
|
115
|
+
confidence?: number;
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
};
|
|
93
118
|
}
|
|
94
119
|
interface KeverdConfig {
|
|
95
120
|
apiKey: string;
|
|
@@ -102,6 +127,21 @@ interface KeverdLoadOptions {
|
|
|
102
127
|
apiKey: string;
|
|
103
128
|
debug?: boolean;
|
|
104
129
|
}
|
|
130
|
+
type LoginResult$1 = 'success' | 'failure';
|
|
131
|
+
type AuthMethod$1 = 'password' | 'password_otp' | 'password_totp' | 'sso' | 'magic_link' | 'passkey' | 'unknown';
|
|
132
|
+
interface LoginContext$1 {
|
|
133
|
+
identifierHash?: string;
|
|
134
|
+
result?: LoginResult$1;
|
|
135
|
+
failureReason?: string;
|
|
136
|
+
authMethod?: AuthMethod$1;
|
|
137
|
+
mfaUsed?: boolean;
|
|
138
|
+
attemptId?: string;
|
|
139
|
+
}
|
|
140
|
+
interface VerifyLoginOptions {
|
|
141
|
+
userId?: string;
|
|
142
|
+
login?: LoginContext$1;
|
|
143
|
+
metadata?: Record<string, unknown>;
|
|
144
|
+
}
|
|
105
145
|
interface KeverdVisitorDataOptions {
|
|
106
146
|
extendedResult?: boolean;
|
|
107
147
|
ignoreCache?: boolean;
|
|
@@ -133,6 +173,11 @@ declare class KeverdService {
|
|
|
133
173
|
* Returns an RxJS Observable
|
|
134
174
|
*/
|
|
135
175
|
getVisitorData(options?: KeverdVisitorDataOptions): Observable<KeverdVisitorData>;
|
|
176
|
+
/**
|
|
177
|
+
* Verify user identity during login attempts.
|
|
178
|
+
* Wraps the web SDK `verifyLogin` and exposes an Observable.
|
|
179
|
+
*/
|
|
180
|
+
verifyLogin(options?: VerifyLoginOptions): Observable<KeverdFingerprintResponse>;
|
|
136
181
|
/**
|
|
137
182
|
* Collect data and send fingerprint request
|
|
138
183
|
* Uses the web SDK which includes all enhanced signals including FingerprintJS
|
|
@@ -214,4 +259,40 @@ declare class KeverdModule {
|
|
|
214
259
|
static forRoot(config: KeverdConfig): ModuleWithProviders<KeverdModule>;
|
|
215
260
|
}
|
|
216
261
|
|
|
217
|
-
|
|
262
|
+
type LoginResult = 'success' | 'failure';
|
|
263
|
+
type AuthMethod = 'password' | 'password_otp' | 'password_totp' | 'sso' | 'magic_link' | 'passkey' | 'unknown';
|
|
264
|
+
interface LoginContext {
|
|
265
|
+
identifierHash?: string;
|
|
266
|
+
result?: LoginResult;
|
|
267
|
+
failureReason?: string;
|
|
268
|
+
authMethod?: AuthMethod;
|
|
269
|
+
mfaUsed?: boolean;
|
|
270
|
+
attemptId?: string;
|
|
271
|
+
}
|
|
272
|
+
interface HashLoginIdentifierOptions {
|
|
273
|
+
salt?: string;
|
|
274
|
+
prefix?: string;
|
|
275
|
+
}
|
|
276
|
+
interface BuildLoginContextOptions {
|
|
277
|
+
identifier: string;
|
|
278
|
+
result?: LoginResult;
|
|
279
|
+
failureReason?: string;
|
|
280
|
+
authMethod?: AuthMethod;
|
|
281
|
+
mfaUsed?: boolean;
|
|
282
|
+
attemptId?: string;
|
|
283
|
+
salt?: string;
|
|
284
|
+
}
|
|
285
|
+
declare function hashLoginIdentifier(identifier: string, options?: HashLoginIdentifierOptions): Promise<string>;
|
|
286
|
+
declare function buildLoginContextFromIdentifier(options: BuildLoginContextOptions): Promise<LoginContext>;
|
|
287
|
+
|
|
288
|
+
interface AdaptiveActionHandlers {
|
|
289
|
+
onAllow?: (response: KeverdFingerprintResponse) => void;
|
|
290
|
+
onSoftChallenge?: (response: KeverdFingerprintResponse) => void;
|
|
291
|
+
onHardChallenge?: (response: KeverdFingerprintResponse) => void;
|
|
292
|
+
onBlock?: (response: KeverdFingerprintResponse) => void;
|
|
293
|
+
onChallenges?: (response: KeverdFingerprintResponse, challenges: string[]) => void;
|
|
294
|
+
onUnknown?: (response: KeverdFingerprintResponse) => void;
|
|
295
|
+
}
|
|
296
|
+
declare function handleAdaptiveResponse(response: KeverdFingerprintResponse, handlers: AdaptiveActionHandlers): void;
|
|
297
|
+
|
|
298
|
+
export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions, buildLoginContextFromIdentifier, handleAdaptiveResponse, hashLoginIdentifier };
|
package/dist/index.d.ts
CHANGED
|
@@ -61,12 +61,30 @@ interface KeverdSimSwapEngine {
|
|
|
61
61
|
updatedProfile?: Record<string, unknown>;
|
|
62
62
|
}
|
|
63
63
|
interface KeverdFingerprintResponse {
|
|
64
|
-
risk_score
|
|
65
|
-
score
|
|
66
|
-
action
|
|
67
|
-
reason
|
|
68
|
-
session_id
|
|
69
|
-
requestId
|
|
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
|
+
confidence?: number;
|
|
71
|
+
fingerprintjs_visitor_id?: string;
|
|
72
|
+
privacy_signals?: {
|
|
73
|
+
is_incognito?: boolean;
|
|
74
|
+
is_vpn?: boolean;
|
|
75
|
+
is_automated?: boolean;
|
|
76
|
+
has_ad_blocker?: boolean;
|
|
77
|
+
};
|
|
78
|
+
device_match?: boolean;
|
|
79
|
+
fraud_probability?: number;
|
|
80
|
+
recommended_action?: string;
|
|
81
|
+
adaptive_response?: {
|
|
82
|
+
recommended_action?: string;
|
|
83
|
+
challenges?: string[];
|
|
84
|
+
reason?: string;
|
|
85
|
+
confidence?: number;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
};
|
|
70
88
|
sim_swap_engine?: KeverdSimSwapEngine;
|
|
71
89
|
}
|
|
72
90
|
interface KeverdPrivacySignals {
|
|
@@ -90,6 +108,13 @@ interface KeverdVisitorData {
|
|
|
90
108
|
deviceMatch?: boolean;
|
|
91
109
|
fraudProbability?: number;
|
|
92
110
|
recommendedAction?: string;
|
|
111
|
+
adaptiveResponse?: {
|
|
112
|
+
recommendedAction?: string;
|
|
113
|
+
challenges?: string[];
|
|
114
|
+
reason?: string;
|
|
115
|
+
confidence?: number;
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
};
|
|
93
118
|
}
|
|
94
119
|
interface KeverdConfig {
|
|
95
120
|
apiKey: string;
|
|
@@ -102,6 +127,21 @@ interface KeverdLoadOptions {
|
|
|
102
127
|
apiKey: string;
|
|
103
128
|
debug?: boolean;
|
|
104
129
|
}
|
|
130
|
+
type LoginResult$1 = 'success' | 'failure';
|
|
131
|
+
type AuthMethod$1 = 'password' | 'password_otp' | 'password_totp' | 'sso' | 'magic_link' | 'passkey' | 'unknown';
|
|
132
|
+
interface LoginContext$1 {
|
|
133
|
+
identifierHash?: string;
|
|
134
|
+
result?: LoginResult$1;
|
|
135
|
+
failureReason?: string;
|
|
136
|
+
authMethod?: AuthMethod$1;
|
|
137
|
+
mfaUsed?: boolean;
|
|
138
|
+
attemptId?: string;
|
|
139
|
+
}
|
|
140
|
+
interface VerifyLoginOptions {
|
|
141
|
+
userId?: string;
|
|
142
|
+
login?: LoginContext$1;
|
|
143
|
+
metadata?: Record<string, unknown>;
|
|
144
|
+
}
|
|
105
145
|
interface KeverdVisitorDataOptions {
|
|
106
146
|
extendedResult?: boolean;
|
|
107
147
|
ignoreCache?: boolean;
|
|
@@ -133,6 +173,11 @@ declare class KeverdService {
|
|
|
133
173
|
* Returns an RxJS Observable
|
|
134
174
|
*/
|
|
135
175
|
getVisitorData(options?: KeverdVisitorDataOptions): Observable<KeverdVisitorData>;
|
|
176
|
+
/**
|
|
177
|
+
* Verify user identity during login attempts.
|
|
178
|
+
* Wraps the web SDK `verifyLogin` and exposes an Observable.
|
|
179
|
+
*/
|
|
180
|
+
verifyLogin(options?: VerifyLoginOptions): Observable<KeverdFingerprintResponse>;
|
|
136
181
|
/**
|
|
137
182
|
* Collect data and send fingerprint request
|
|
138
183
|
* Uses the web SDK which includes all enhanced signals including FingerprintJS
|
|
@@ -214,4 +259,40 @@ declare class KeverdModule {
|
|
|
214
259
|
static forRoot(config: KeverdConfig): ModuleWithProviders<KeverdModule>;
|
|
215
260
|
}
|
|
216
261
|
|
|
217
|
-
|
|
262
|
+
type LoginResult = 'success' | 'failure';
|
|
263
|
+
type AuthMethod = 'password' | 'password_otp' | 'password_totp' | 'sso' | 'magic_link' | 'passkey' | 'unknown';
|
|
264
|
+
interface LoginContext {
|
|
265
|
+
identifierHash?: string;
|
|
266
|
+
result?: LoginResult;
|
|
267
|
+
failureReason?: string;
|
|
268
|
+
authMethod?: AuthMethod;
|
|
269
|
+
mfaUsed?: boolean;
|
|
270
|
+
attemptId?: string;
|
|
271
|
+
}
|
|
272
|
+
interface HashLoginIdentifierOptions {
|
|
273
|
+
salt?: string;
|
|
274
|
+
prefix?: string;
|
|
275
|
+
}
|
|
276
|
+
interface BuildLoginContextOptions {
|
|
277
|
+
identifier: string;
|
|
278
|
+
result?: LoginResult;
|
|
279
|
+
failureReason?: string;
|
|
280
|
+
authMethod?: AuthMethod;
|
|
281
|
+
mfaUsed?: boolean;
|
|
282
|
+
attemptId?: string;
|
|
283
|
+
salt?: string;
|
|
284
|
+
}
|
|
285
|
+
declare function hashLoginIdentifier(identifier: string, options?: HashLoginIdentifierOptions): Promise<string>;
|
|
286
|
+
declare function buildLoginContextFromIdentifier(options: BuildLoginContextOptions): Promise<LoginContext>;
|
|
287
|
+
|
|
288
|
+
interface AdaptiveActionHandlers {
|
|
289
|
+
onAllow?: (response: KeverdFingerprintResponse) => void;
|
|
290
|
+
onSoftChallenge?: (response: KeverdFingerprintResponse) => void;
|
|
291
|
+
onHardChallenge?: (response: KeverdFingerprintResponse) => void;
|
|
292
|
+
onBlock?: (response: KeverdFingerprintResponse) => void;
|
|
293
|
+
onChallenges?: (response: KeverdFingerprintResponse, challenges: string[]) => void;
|
|
294
|
+
onUnknown?: (response: KeverdFingerprintResponse) => void;
|
|
295
|
+
}
|
|
296
|
+
declare function handleAdaptiveResponse(response: KeverdFingerprintResponse, handlers: AdaptiveActionHandlers): void;
|
|
297
|
+
|
|
298
|
+
export { type KeverdBehavioralData, type KeverdConfig, type KeverdDeviceInfo, type KeverdError, type KeverdFingerprintRequest, type KeverdFingerprintResponse, type KeverdLoadOptions, KeverdModule, KeverdService, type KeverdSessionInfo, type KeverdVisitorData, type KeverdVisitorDataOptions, buildLoginContextFromIdentifier, handleAdaptiveResponse, hashLoginIdentifier };
|