@fingerly/types 0.3.0 → 0.4.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 CHANGED
@@ -26,8 +26,9 @@ the browser SDKs (`@fingerly/core`, `@fingerly/web-js`, and the framework bindin
26
26
  TypeScript mobile bridges (`@fingerly/react-native`, `@fingerly/lynx`).
27
27
  [Fingerly](https://fingerly.io) is device intelligence for fraud prevention.
28
28
 
29
- This package contains TypeScript declarations only (`ES2020`, zero DOM globals, zero runtime
30
- code). Collection, transport, hardware attestation, and scoring belong to the platform SDKs and
29
+ This package contains TypeScript declarations and a few plain string constants
30
+ (`ES2020`, zero DOM globals, no side effects, so a bundler drops what you do not import).
31
+ Collection, transport, hardware attestation, and scoring belong to the platform SDKs and
31
32
  the Fingerly server. Stored events are read server-side with a secret key, so their types live in
32
33
  the server SDKs. You do not need this package to use Fingerly: the browser and framework packages
33
34
  already depend on it. Install it when you want to type your own code against the same shapes.
@@ -39,15 +40,16 @@ already depend on it. Install it when you want to type your own code against the
39
40
  2. Install:
40
41
 
41
42
  ```sh
42
- npm install -D @fingerly/types@^0.3.0
43
+ npm install -D @fingerly/types@^0.4.0
43
44
  ```
44
45
 
45
- 3. Import the types you need:
46
+ 3. Import the types and constants you need:
46
47
 
47
48
  ```ts
48
- import type { IdentifyResult } from '@fingerly/types'
49
+ import { SuspectLevel, type IdentifyResult } from '@fingerly/types'
49
50
 
50
51
  function describe(result: IdentifyResult): string {
52
+ if (result.suspectLevel === SuspectLevel.High) return `${result.visitorId}: review`
51
53
  return `${result.visitorId}: ${result.suspectLevel ?? 'not scored'}`
52
54
  }
53
55
  ```
@@ -70,7 +72,16 @@ The package ships ESM and CommonJS entry points with declarations (`dist` only).
70
72
  inside an embedded WebView, or on high-risk unmatched Web traffic),
71
73
  `visitorConfidence`, `identifiable`, `duplicate`, `state`, `suspectScore`
72
74
  and `suspectLevel`. The signal report is what `collect()` returns.
73
- - **Canonical v3 risk signal union (`RiskSignal`).**
75
+ - **Canonical v3 risk signal catalogue (`Signal`, with `RiskSignal` as its type and the open
76
+ `SignalName`).** A trigger's `signal` is a raw detector, such as `Signal.VpnPublic`; its
77
+ `group` is the group it is reported under, such as `Signal.Vpn`.
78
+ - **Runtime constants.** Every closed set of values is an `as const` object with a same-named
79
+ type: `Signal`, `SuspectLevel`, `Confidence`, `EventState`, `ConsentState`,
80
+ `IncognitoDetection` and `SdkPlatform`. A member is its value in PascalCase, word by word
81
+ (`Signal.FingerprintSuppressed` is `'fingerprint_suppressed'`, `SdkPlatform.ReactNativeIos`
82
+ is `'react-native-ios'`). Comparing with the constant or with the string both compile, and
83
+ server-filled fields such as `state` and `IdentifyTrigger.signal` are typed open
84
+ (`EventState | (string & {})`), so a value a newer server adds still type-checks.
74
85
 
75
86
  ## Development
76
87
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,121 @@
1
1
  'use strict';
2
2
 
3
+ // src/index.ts
4
+ var SdkPlatform = {
5
+ Web: "web",
6
+ Android: "android",
7
+ Ios: "ios",
8
+ ReactNativeIos: "react-native-ios",
9
+ ReactNativeAndroid: "react-native-android",
10
+ FlutterIos: "flutter-ios",
11
+ FlutterAndroid: "flutter-android",
12
+ LynxIos: "lynx-ios",
13
+ LynxAndroid: "lynx-android"
14
+ };
15
+ var IncognitoDetection = {
16
+ Standard: "standard",
17
+ Extended: "extended"
18
+ };
19
+ var ConsentState = {
20
+ Granted: "granted",
21
+ Pending: "pending",
22
+ Denied: "denied"
23
+ };
24
+ var Confidence = {
25
+ Low: "low",
26
+ Medium: "medium",
27
+ High: "high"
28
+ };
29
+ var SuspectLevel = {
30
+ Low: "low",
31
+ Medium: "medium",
32
+ High: "high"
33
+ };
34
+ var Signal = {
35
+ Tor: "tor",
36
+ DatacenterProxy: "datacenter_proxy",
37
+ Proxy: "proxy",
38
+ DatacenterIp: "datacenter_ip",
39
+ ResidentialProxy: "residential_proxy",
40
+ ResidentialProxyLowConfidence: "residential_proxy_low_confidence",
41
+ ResidentialProxyMediumConfidence: "residential_proxy_medium_confidence",
42
+ ResidentialProxyHighConfidence: "residential_proxy_high_confidence",
43
+ Vpn: "vpn",
44
+ VpnPublic: "vpn_public",
45
+ VpnTimezone: "vpn_timezone",
46
+ VpnRelay: "vpn_relay",
47
+ VpnMobile: "vpn_mobile",
48
+ VpnOsMismatch: "vpn_os_mismatch",
49
+ VpnLowConfidence: "vpn_low_confidence",
50
+ VpnMediumConfidence: "vpn_medium_confidence",
51
+ VpnHighConfidence: "vpn_high_confidence",
52
+ IpBlocklist: "ip_blocklist",
53
+ IpBlocklistEmailSpam: "ip_blocklist_email_spam",
54
+ IpBlocklistAttackSource: "ip_blocklist_attack_source",
55
+ IpReputation: "ip_reputation",
56
+ IpAbuser: "ip_abuser",
57
+ NetworkAnomaly: "network_anomaly",
58
+ BogonIp: "bogon_ip",
59
+ AnycastIp: "anycast_ip",
60
+ LocationSpoofing: "location_spoofing",
61
+ GeoMismatch: "geo_mismatch",
62
+ IosSimulator: "ios_simulator",
63
+ Simulator: "simulator",
64
+ AndroidEmulator: "android_emulator",
65
+ Emulator: "emulator",
66
+ VirtualMachine: "virtual_machine",
67
+ JailbrokenDevice: "jailbroken_device",
68
+ Jailbreak: "jailbreak",
69
+ RootedDevice: "rooted_device",
70
+ RootApps: "root_apps",
71
+ PlayDeviceIntegrityFailed: "play_device_integrity_failed",
72
+ ClonedApp: "cloned_app",
73
+ AppCloner: "app_cloner",
74
+ PlayAppUnrecognized: "play_app_unrecognized",
75
+ DeviceFarm: "device_farm",
76
+ RepeatedReinstall: "repeated_reinstall",
77
+ DeviceActivityHigh: "device_activity_high",
78
+ DeviceActivityVeryHigh: "device_activity_very_high",
79
+ MitmAttack: "mitm_attack",
80
+ FridaDetected: "frida_detected",
81
+ Frida: "frida",
82
+ BrowserTampering: "browser_tampering",
83
+ Tampering: "tampering",
84
+ AntidetectBrowser: "antidetect_browser",
85
+ FingerprintSuppressed: "fingerprint_suppressed",
86
+ DeveloperTools: "developer_tools",
87
+ RemoteControl: "remote_control",
88
+ Bot: "bot",
89
+ Automation: "automation",
90
+ BadBot: "bad_bot",
91
+ FetchMetadataMissing: "fetch_metadata_missing",
92
+ WebTicketMissing: "web_ticket_missing",
93
+ WebTicketInvalid: "web_ticket_invalid",
94
+ HighActivity: "high_activity",
95
+ IncognitoMode: "incognito_mode",
96
+ Incognito: "incognito",
97
+ PrivacySettings: "privacy_settings",
98
+ EmbeddedWebView: "embedded_web_view",
99
+ ActiveCall: "active_call",
100
+ AttestationMissing: "attestation_missing",
101
+ AttestationFailed: "attestation_failed",
102
+ AttestationDowngrade: "attestation_downgrade",
103
+ DeviceInconsistent: "device_inconsistent",
104
+ ReportIncomplete: "report_incomplete",
105
+ ProbeErrors: "probe_errors",
106
+ CustomRootCa: "custom_root_ca",
107
+ SecondaryUserProfile: "secondary_user_profile"
108
+ };
109
+ var EventState = {
110
+ Pending: "pending",
111
+ Enriched: "enriched",
112
+ Unavailable: "unavailable"
113
+ };
114
+
115
+ exports.Confidence = Confidence;
116
+ exports.ConsentState = ConsentState;
117
+ exports.EventState = EventState;
118
+ exports.IncognitoDetection = IncognitoDetection;
119
+ exports.SdkPlatform = SdkPlatform;
120
+ exports.Signal = Signal;
121
+ exports.SuspectLevel = SuspectLevel;
package/dist/index.d.cts CHANGED
@@ -4,14 +4,38 @@
4
4
  * Nothing here touches the DOM. A type that only a browser can populate still
5
5
  * belongs in this file, because the server and the mobile SDKs both need to
6
6
  * name it; what does not belong here is the code that reads a `window`.
7
+ *
8
+ * Every closed set of values is an `as const` object with a same-named type,
9
+ * so `result.suspectLevel === SuspectLevel.High` and
10
+ * `result.suspectLevel === 'high'` both type-check. A member is its value in
11
+ * PascalCase, word by word: `fingerprint_suppressed` is
12
+ * `Signal.FingerprintSuppressed`, `react-native-ios` is
13
+ * `SdkPlatform.ReactNativeIos`.
7
14
  */
8
15
  /** Which SDK collected a report. Mirrors `schemas.SDKInfo` on the server. */
9
- type SdkPlatform = 'web' | 'android' | 'ios' | 'react-native-ios' | 'react-native-android' | 'flutter-ios' | 'flutter-android' | 'lynx-ios' | 'lynx-android';
16
+ declare const SdkPlatform: {
17
+ readonly Web: "web";
18
+ readonly Android: "android";
19
+ readonly Ios: "ios";
20
+ readonly ReactNativeIos: "react-native-ios";
21
+ readonly ReactNativeAndroid: "react-native-android";
22
+ readonly FlutterIos: "flutter-ios";
23
+ readonly FlutterAndroid: "flutter-android";
24
+ readonly LynxIos: "lynx-ios";
25
+ readonly LynxAndroid: "lynx-android";
26
+ };
27
+ /** One of the platforms in {@link SdkPlatform}. */
28
+ type SdkPlatform = (typeof SdkPlatform)[keyof typeof SdkPlatform];
10
29
  /**
11
30
  * Whether opt-in extended incognito probes (such as Chromium IndexedDB
12
31
  * durability timing) execute alongside zero-write standard probes.
13
32
  */
14
- type IncognitoDetection = 'standard' | 'extended';
33
+ declare const IncognitoDetection: {
34
+ readonly Standard: "standard";
35
+ readonly Extended: "extended";
36
+ };
37
+ /** One of the modes in {@link IncognitoDetection}. */
38
+ type IncognitoDetection = (typeof IncognitoDetection)[keyof typeof IncognitoDetection];
15
39
  /** Minimal runtime-agnostic `AbortSignal` contract (compiles under pure ES2020 without DOM). */
16
40
  interface AbortSignalLike {
17
41
  readonly aborted: boolean;
@@ -58,7 +82,13 @@ interface MobileIdentifyOptions {
58
82
  * source, touch no storage, send nothing, and fail `identify()` with a consent
59
83
  * error - and are kept apart only because a consent tool reports them apart.
60
84
  */
61
- type ConsentState = 'granted' | 'pending' | 'denied';
85
+ declare const ConsentState: {
86
+ readonly Granted: "granted";
87
+ readonly Pending: "pending";
88
+ readonly Denied: "denied";
89
+ };
90
+ /** One of the states in {@link ConsentState}. */
91
+ type ConsentState = (typeof ConsentState)[keyof typeof ConsentState];
62
92
  /**
63
93
  * How a source finished.
64
94
  *
@@ -130,18 +160,128 @@ interface SignalReport {
130
160
  integrity: IntegrityReport;
131
161
  }
132
162
  /** How sure the server is of a finding. Matches its `*_confidence` fields. */
133
- type Confidence = 'low' | 'medium' | 'high';
163
+ declare const Confidence: {
164
+ readonly Low: "low";
165
+ readonly Medium: "medium";
166
+ readonly High: "high";
167
+ };
168
+ /** One of the grades in {@link Confidence}. */
169
+ type Confidence = (typeof Confidence)[keyof typeof Confidence];
134
170
  /** Categorical risk band returned by the server. */
135
- type SuspectLevel = 'low' | 'medium' | 'high';
171
+ declare const SuspectLevel: {
172
+ readonly Low: "low";
173
+ readonly Medium: "medium";
174
+ readonly High: "high";
175
+ };
176
+ /** One of the levels in {@link SuspectLevel}. */
177
+ type SuspectLevel = (typeof SuspectLevel)[keyof typeof SuspectLevel];
178
+ /**
179
+ * Every signal group and raw detector identifier the server reports, the same
180
+ * list as `Signal` in `@fingerly/node`. A trigger's `signal` is a raw
181
+ * detector, such as `vpn_public`; its `group` is the group it is reported
182
+ * under, such as `vpn`.
183
+ */
184
+ declare const Signal: {
185
+ readonly Tor: "tor";
186
+ readonly DatacenterProxy: "datacenter_proxy";
187
+ readonly Proxy: "proxy";
188
+ readonly DatacenterIp: "datacenter_ip";
189
+ readonly ResidentialProxy: "residential_proxy";
190
+ readonly ResidentialProxyLowConfidence: "residential_proxy_low_confidence";
191
+ readonly ResidentialProxyMediumConfidence: "residential_proxy_medium_confidence";
192
+ readonly ResidentialProxyHighConfidence: "residential_proxy_high_confidence";
193
+ readonly Vpn: "vpn";
194
+ readonly VpnPublic: "vpn_public";
195
+ readonly VpnTimezone: "vpn_timezone";
196
+ readonly VpnRelay: "vpn_relay";
197
+ readonly VpnMobile: "vpn_mobile";
198
+ readonly VpnOsMismatch: "vpn_os_mismatch";
199
+ readonly VpnLowConfidence: "vpn_low_confidence";
200
+ readonly VpnMediumConfidence: "vpn_medium_confidence";
201
+ readonly VpnHighConfidence: "vpn_high_confidence";
202
+ readonly IpBlocklist: "ip_blocklist";
203
+ readonly IpBlocklistEmailSpam: "ip_blocklist_email_spam";
204
+ readonly IpBlocklistAttackSource: "ip_blocklist_attack_source";
205
+ readonly IpReputation: "ip_reputation";
206
+ readonly IpAbuser: "ip_abuser";
207
+ readonly NetworkAnomaly: "network_anomaly";
208
+ readonly BogonIp: "bogon_ip";
209
+ readonly AnycastIp: "anycast_ip";
210
+ readonly LocationSpoofing: "location_spoofing";
211
+ readonly GeoMismatch: "geo_mismatch";
212
+ readonly IosSimulator: "ios_simulator";
213
+ readonly Simulator: "simulator";
214
+ readonly AndroidEmulator: "android_emulator";
215
+ readonly Emulator: "emulator";
216
+ readonly VirtualMachine: "virtual_machine";
217
+ readonly JailbrokenDevice: "jailbroken_device";
218
+ readonly Jailbreak: "jailbreak";
219
+ readonly RootedDevice: "rooted_device";
220
+ readonly RootApps: "root_apps";
221
+ readonly PlayDeviceIntegrityFailed: "play_device_integrity_failed";
222
+ readonly ClonedApp: "cloned_app";
223
+ readonly AppCloner: "app_cloner";
224
+ readonly PlayAppUnrecognized: "play_app_unrecognized";
225
+ readonly DeviceFarm: "device_farm";
226
+ readonly RepeatedReinstall: "repeated_reinstall";
227
+ readonly DeviceActivityHigh: "device_activity_high";
228
+ readonly DeviceActivityVeryHigh: "device_activity_very_high";
229
+ readonly MitmAttack: "mitm_attack";
230
+ readonly FridaDetected: "frida_detected";
231
+ readonly Frida: "frida";
232
+ readonly BrowserTampering: "browser_tampering";
233
+ readonly Tampering: "tampering";
234
+ readonly AntidetectBrowser: "antidetect_browser";
235
+ readonly FingerprintSuppressed: "fingerprint_suppressed";
236
+ readonly DeveloperTools: "developer_tools";
237
+ readonly RemoteControl: "remote_control";
238
+ readonly Bot: "bot";
239
+ readonly Automation: "automation";
240
+ readonly BadBot: "bad_bot";
241
+ readonly FetchMetadataMissing: "fetch_metadata_missing";
242
+ readonly WebTicketMissing: "web_ticket_missing";
243
+ readonly WebTicketInvalid: "web_ticket_invalid";
244
+ readonly HighActivity: "high_activity";
245
+ readonly IncognitoMode: "incognito_mode";
246
+ readonly Incognito: "incognito";
247
+ readonly PrivacySettings: "privacy_settings";
248
+ readonly EmbeddedWebView: "embedded_web_view";
249
+ readonly ActiveCall: "active_call";
250
+ readonly AttestationMissing: "attestation_missing";
251
+ readonly AttestationFailed: "attestation_failed";
252
+ readonly AttestationDowngrade: "attestation_downgrade";
253
+ readonly DeviceInconsistent: "device_inconsistent";
254
+ readonly ReportIncomplete: "report_incomplete";
255
+ readonly ProbeErrors: "probe_errors";
256
+ readonly CustomRootCa: "custom_root_ca";
257
+ readonly SecondaryUserProfile: "secondary_user_profile";
258
+ };
259
+ /** One of the signals in {@link Signal}. */
260
+ type Signal = (typeof Signal)[keyof typeof Signal];
261
+ /**
262
+ * One of the signals in {@link Signal}, or a value a newer server added, so
263
+ * code built today still compiles against it.
264
+ */
265
+ type SignalName = Signal | (string & {});
266
+ /** The canonical v3 risk signal catalogue: the closed {@link Signal} list. */
267
+ type RiskSignal = Signal;
136
268
  /**
137
- * Canonical v3 risk signal catalogue (`sdks/contract/openapi.json` &
138
- * `sdks/contract/v3-manifest.json`).
269
+ * An identification's `state`, the same list as `EventState` in
270
+ * `@fingerly/node`: `Enriched` when it was fully processed, `Unavailable`
271
+ * when the network lookup could not run, so it was not scored. `Pending` is
272
+ * a server read's "not recorded yet"; an identify answer is never pending.
139
273
  */
140
- type RiskSignal = 'high_activity' | 'tampering' | 'device_farm' | 'developer_tools' | 'geo_mismatch' | 'device_inconsistent' | 'report_incomplete' | 'fingerprint_suppressed' | 'tor' | 'proxy' | 'residential_proxy' | 'residential_proxy_low_confidence' | 'residential_proxy_medium_confidence' | 'residential_proxy_high_confidence' | 'vpn_public' | 'vpn_timezone' | 'vpn_relay' | 'vpn_mobile' | 'vpn_os_mismatch' | 'vpn_low_confidence' | 'vpn_medium_confidence' | 'vpn_high_confidence' | 'ip_blocklist_email_spam' | 'ip_blocklist_attack_source' | 'ip_abuser' | 'datacenter_ip' | 'bogon_ip' | 'anycast_ip' | 'incognito' | 'bad_bot' | 'automation' | 'fetch_metadata_missing' | 'web_ticket_missing' | 'web_ticket_invalid' | 'antidetect_browser' | 'virtual_machine' | 'privacy_settings' | 'embedded_web_view' | 'remote_control' | 'emulator' | 'root_apps' | 'app_cloner' | 'jailbreak' | 'simulator' | 'frida' | 'mitm_attack' | 'active_call' | 'attestation_missing' | 'attestation_downgrade' | 'app_attest_key_churn' | 'play_device_integrity_failed' | 'play_app_unrecognized' | 'attestation_failed' | 'probe_errors' | 'custom_root_ca' | 'secondary_user_profile';
274
+ declare const EventState: {
275
+ readonly Pending: "pending";
276
+ readonly Enriched: "enriched";
277
+ readonly Unavailable: "unavailable";
278
+ };
279
+ /** One of the states in {@link EventState}. */
280
+ type EventState = (typeof EventState)[keyof typeof EventState];
141
281
  /** One active risk trigger (`IdentifyTriggerOut` in OpenAPI). */
142
282
  interface IdentifyTrigger {
143
- signal: RiskSignal | (string & {});
144
- group?: string;
283
+ signal: SignalName;
284
+ group?: SignalName;
145
285
  weight?: number | null;
146
286
  confidence?: Confidence | (string & {});
147
287
  }
@@ -165,7 +305,7 @@ interface NativeIdentifyResult {
165
305
  */
166
306
  duplicate: boolean | null;
167
307
  /** As [[IdentifyResult.state]]. */
168
- state: string;
308
+ state: EventState | (string & {});
169
309
  /** `null` when absent: unscored, or hidden by the SDK key. Not the same as zero. */
170
310
  suspectScore: number | null;
171
311
  /** `null` when absent, for the same reasons as [[suspectScore]]. */
@@ -258,7 +398,7 @@ interface IdentifyResult {
258
398
  /**
259
399
  * `enriched`, or `unavailable` when the address could not be looked up.
260
400
  */
261
- state: string;
401
+ state: EventState | (string & {});
262
402
  /**
263
403
  * Weighted sum of the signals that fired, or `null` when unscored or hidden
264
404
  * by `hide_client_score` on public keys.
@@ -273,4 +413,4 @@ interface IdentifyResult {
273
413
  triggers?: IdentifyTrigger[];
274
414
  }
275
415
 
276
- export type { AbortSignalLike, CollectOptions, Confidence, ConsentState, EngineIdentity, FreshnessTicket, IdentifyOptions, IdentifyResult, IdentifySubmission, IdentifyTrigger, IncognitoDetection, IntegrityReport, Lie, LieKind, MobileFingerlyOptions, MobileIdentifyOptions, NativeIdentifyResult, RiskSignal, SdkPlatform, SignalOutcome, SignalReport, SignalStatus, SourceStage, SuspectLevel, TicketRequest };
416
+ export { type AbortSignalLike, type CollectOptions, Confidence, ConsentState, type EngineIdentity, EventState, type FreshnessTicket, type IdentifyOptions, type IdentifyResult, type IdentifySubmission, type IdentifyTrigger, IncognitoDetection, type IntegrityReport, type Lie, type LieKind, type MobileFingerlyOptions, type MobileIdentifyOptions, type NativeIdentifyResult, type RiskSignal, SdkPlatform, Signal, type SignalName, type SignalOutcome, type SignalReport, type SignalStatus, type SourceStage, SuspectLevel, type TicketRequest };
package/dist/index.d.ts CHANGED
@@ -4,14 +4,38 @@
4
4
  * Nothing here touches the DOM. A type that only a browser can populate still
5
5
  * belongs in this file, because the server and the mobile SDKs both need to
6
6
  * name it; what does not belong here is the code that reads a `window`.
7
+ *
8
+ * Every closed set of values is an `as const` object with a same-named type,
9
+ * so `result.suspectLevel === SuspectLevel.High` and
10
+ * `result.suspectLevel === 'high'` both type-check. A member is its value in
11
+ * PascalCase, word by word: `fingerprint_suppressed` is
12
+ * `Signal.FingerprintSuppressed`, `react-native-ios` is
13
+ * `SdkPlatform.ReactNativeIos`.
7
14
  */
8
15
  /** Which SDK collected a report. Mirrors `schemas.SDKInfo` on the server. */
9
- type SdkPlatform = 'web' | 'android' | 'ios' | 'react-native-ios' | 'react-native-android' | 'flutter-ios' | 'flutter-android' | 'lynx-ios' | 'lynx-android';
16
+ declare const SdkPlatform: {
17
+ readonly Web: "web";
18
+ readonly Android: "android";
19
+ readonly Ios: "ios";
20
+ readonly ReactNativeIos: "react-native-ios";
21
+ readonly ReactNativeAndroid: "react-native-android";
22
+ readonly FlutterIos: "flutter-ios";
23
+ readonly FlutterAndroid: "flutter-android";
24
+ readonly LynxIos: "lynx-ios";
25
+ readonly LynxAndroid: "lynx-android";
26
+ };
27
+ /** One of the platforms in {@link SdkPlatform}. */
28
+ type SdkPlatform = (typeof SdkPlatform)[keyof typeof SdkPlatform];
10
29
  /**
11
30
  * Whether opt-in extended incognito probes (such as Chromium IndexedDB
12
31
  * durability timing) execute alongside zero-write standard probes.
13
32
  */
14
- type IncognitoDetection = 'standard' | 'extended';
33
+ declare const IncognitoDetection: {
34
+ readonly Standard: "standard";
35
+ readonly Extended: "extended";
36
+ };
37
+ /** One of the modes in {@link IncognitoDetection}. */
38
+ type IncognitoDetection = (typeof IncognitoDetection)[keyof typeof IncognitoDetection];
15
39
  /** Minimal runtime-agnostic `AbortSignal` contract (compiles under pure ES2020 without DOM). */
16
40
  interface AbortSignalLike {
17
41
  readonly aborted: boolean;
@@ -58,7 +82,13 @@ interface MobileIdentifyOptions {
58
82
  * source, touch no storage, send nothing, and fail `identify()` with a consent
59
83
  * error - and are kept apart only because a consent tool reports them apart.
60
84
  */
61
- type ConsentState = 'granted' | 'pending' | 'denied';
85
+ declare const ConsentState: {
86
+ readonly Granted: "granted";
87
+ readonly Pending: "pending";
88
+ readonly Denied: "denied";
89
+ };
90
+ /** One of the states in {@link ConsentState}. */
91
+ type ConsentState = (typeof ConsentState)[keyof typeof ConsentState];
62
92
  /**
63
93
  * How a source finished.
64
94
  *
@@ -130,18 +160,128 @@ interface SignalReport {
130
160
  integrity: IntegrityReport;
131
161
  }
132
162
  /** How sure the server is of a finding. Matches its `*_confidence` fields. */
133
- type Confidence = 'low' | 'medium' | 'high';
163
+ declare const Confidence: {
164
+ readonly Low: "low";
165
+ readonly Medium: "medium";
166
+ readonly High: "high";
167
+ };
168
+ /** One of the grades in {@link Confidence}. */
169
+ type Confidence = (typeof Confidence)[keyof typeof Confidence];
134
170
  /** Categorical risk band returned by the server. */
135
- type SuspectLevel = 'low' | 'medium' | 'high';
171
+ declare const SuspectLevel: {
172
+ readonly Low: "low";
173
+ readonly Medium: "medium";
174
+ readonly High: "high";
175
+ };
176
+ /** One of the levels in {@link SuspectLevel}. */
177
+ type SuspectLevel = (typeof SuspectLevel)[keyof typeof SuspectLevel];
178
+ /**
179
+ * Every signal group and raw detector identifier the server reports, the same
180
+ * list as `Signal` in `@fingerly/node`. A trigger's `signal` is a raw
181
+ * detector, such as `vpn_public`; its `group` is the group it is reported
182
+ * under, such as `vpn`.
183
+ */
184
+ declare const Signal: {
185
+ readonly Tor: "tor";
186
+ readonly DatacenterProxy: "datacenter_proxy";
187
+ readonly Proxy: "proxy";
188
+ readonly DatacenterIp: "datacenter_ip";
189
+ readonly ResidentialProxy: "residential_proxy";
190
+ readonly ResidentialProxyLowConfidence: "residential_proxy_low_confidence";
191
+ readonly ResidentialProxyMediumConfidence: "residential_proxy_medium_confidence";
192
+ readonly ResidentialProxyHighConfidence: "residential_proxy_high_confidence";
193
+ readonly Vpn: "vpn";
194
+ readonly VpnPublic: "vpn_public";
195
+ readonly VpnTimezone: "vpn_timezone";
196
+ readonly VpnRelay: "vpn_relay";
197
+ readonly VpnMobile: "vpn_mobile";
198
+ readonly VpnOsMismatch: "vpn_os_mismatch";
199
+ readonly VpnLowConfidence: "vpn_low_confidence";
200
+ readonly VpnMediumConfidence: "vpn_medium_confidence";
201
+ readonly VpnHighConfidence: "vpn_high_confidence";
202
+ readonly IpBlocklist: "ip_blocklist";
203
+ readonly IpBlocklistEmailSpam: "ip_blocklist_email_spam";
204
+ readonly IpBlocklistAttackSource: "ip_blocklist_attack_source";
205
+ readonly IpReputation: "ip_reputation";
206
+ readonly IpAbuser: "ip_abuser";
207
+ readonly NetworkAnomaly: "network_anomaly";
208
+ readonly BogonIp: "bogon_ip";
209
+ readonly AnycastIp: "anycast_ip";
210
+ readonly LocationSpoofing: "location_spoofing";
211
+ readonly GeoMismatch: "geo_mismatch";
212
+ readonly IosSimulator: "ios_simulator";
213
+ readonly Simulator: "simulator";
214
+ readonly AndroidEmulator: "android_emulator";
215
+ readonly Emulator: "emulator";
216
+ readonly VirtualMachine: "virtual_machine";
217
+ readonly JailbrokenDevice: "jailbroken_device";
218
+ readonly Jailbreak: "jailbreak";
219
+ readonly RootedDevice: "rooted_device";
220
+ readonly RootApps: "root_apps";
221
+ readonly PlayDeviceIntegrityFailed: "play_device_integrity_failed";
222
+ readonly ClonedApp: "cloned_app";
223
+ readonly AppCloner: "app_cloner";
224
+ readonly PlayAppUnrecognized: "play_app_unrecognized";
225
+ readonly DeviceFarm: "device_farm";
226
+ readonly RepeatedReinstall: "repeated_reinstall";
227
+ readonly DeviceActivityHigh: "device_activity_high";
228
+ readonly DeviceActivityVeryHigh: "device_activity_very_high";
229
+ readonly MitmAttack: "mitm_attack";
230
+ readonly FridaDetected: "frida_detected";
231
+ readonly Frida: "frida";
232
+ readonly BrowserTampering: "browser_tampering";
233
+ readonly Tampering: "tampering";
234
+ readonly AntidetectBrowser: "antidetect_browser";
235
+ readonly FingerprintSuppressed: "fingerprint_suppressed";
236
+ readonly DeveloperTools: "developer_tools";
237
+ readonly RemoteControl: "remote_control";
238
+ readonly Bot: "bot";
239
+ readonly Automation: "automation";
240
+ readonly BadBot: "bad_bot";
241
+ readonly FetchMetadataMissing: "fetch_metadata_missing";
242
+ readonly WebTicketMissing: "web_ticket_missing";
243
+ readonly WebTicketInvalid: "web_ticket_invalid";
244
+ readonly HighActivity: "high_activity";
245
+ readonly IncognitoMode: "incognito_mode";
246
+ readonly Incognito: "incognito";
247
+ readonly PrivacySettings: "privacy_settings";
248
+ readonly EmbeddedWebView: "embedded_web_view";
249
+ readonly ActiveCall: "active_call";
250
+ readonly AttestationMissing: "attestation_missing";
251
+ readonly AttestationFailed: "attestation_failed";
252
+ readonly AttestationDowngrade: "attestation_downgrade";
253
+ readonly DeviceInconsistent: "device_inconsistent";
254
+ readonly ReportIncomplete: "report_incomplete";
255
+ readonly ProbeErrors: "probe_errors";
256
+ readonly CustomRootCa: "custom_root_ca";
257
+ readonly SecondaryUserProfile: "secondary_user_profile";
258
+ };
259
+ /** One of the signals in {@link Signal}. */
260
+ type Signal = (typeof Signal)[keyof typeof Signal];
261
+ /**
262
+ * One of the signals in {@link Signal}, or a value a newer server added, so
263
+ * code built today still compiles against it.
264
+ */
265
+ type SignalName = Signal | (string & {});
266
+ /** The canonical v3 risk signal catalogue: the closed {@link Signal} list. */
267
+ type RiskSignal = Signal;
136
268
  /**
137
- * Canonical v3 risk signal catalogue (`sdks/contract/openapi.json` &
138
- * `sdks/contract/v3-manifest.json`).
269
+ * An identification's `state`, the same list as `EventState` in
270
+ * `@fingerly/node`: `Enriched` when it was fully processed, `Unavailable`
271
+ * when the network lookup could not run, so it was not scored. `Pending` is
272
+ * a server read's "not recorded yet"; an identify answer is never pending.
139
273
  */
140
- type RiskSignal = 'high_activity' | 'tampering' | 'device_farm' | 'developer_tools' | 'geo_mismatch' | 'device_inconsistent' | 'report_incomplete' | 'fingerprint_suppressed' | 'tor' | 'proxy' | 'residential_proxy' | 'residential_proxy_low_confidence' | 'residential_proxy_medium_confidence' | 'residential_proxy_high_confidence' | 'vpn_public' | 'vpn_timezone' | 'vpn_relay' | 'vpn_mobile' | 'vpn_os_mismatch' | 'vpn_low_confidence' | 'vpn_medium_confidence' | 'vpn_high_confidence' | 'ip_blocklist_email_spam' | 'ip_blocklist_attack_source' | 'ip_abuser' | 'datacenter_ip' | 'bogon_ip' | 'anycast_ip' | 'incognito' | 'bad_bot' | 'automation' | 'fetch_metadata_missing' | 'web_ticket_missing' | 'web_ticket_invalid' | 'antidetect_browser' | 'virtual_machine' | 'privacy_settings' | 'embedded_web_view' | 'remote_control' | 'emulator' | 'root_apps' | 'app_cloner' | 'jailbreak' | 'simulator' | 'frida' | 'mitm_attack' | 'active_call' | 'attestation_missing' | 'attestation_downgrade' | 'app_attest_key_churn' | 'play_device_integrity_failed' | 'play_app_unrecognized' | 'attestation_failed' | 'probe_errors' | 'custom_root_ca' | 'secondary_user_profile';
274
+ declare const EventState: {
275
+ readonly Pending: "pending";
276
+ readonly Enriched: "enriched";
277
+ readonly Unavailable: "unavailable";
278
+ };
279
+ /** One of the states in {@link EventState}. */
280
+ type EventState = (typeof EventState)[keyof typeof EventState];
141
281
  /** One active risk trigger (`IdentifyTriggerOut` in OpenAPI). */
142
282
  interface IdentifyTrigger {
143
- signal: RiskSignal | (string & {});
144
- group?: string;
283
+ signal: SignalName;
284
+ group?: SignalName;
145
285
  weight?: number | null;
146
286
  confidence?: Confidence | (string & {});
147
287
  }
@@ -165,7 +305,7 @@ interface NativeIdentifyResult {
165
305
  */
166
306
  duplicate: boolean | null;
167
307
  /** As [[IdentifyResult.state]]. */
168
- state: string;
308
+ state: EventState | (string & {});
169
309
  /** `null` when absent: unscored, or hidden by the SDK key. Not the same as zero. */
170
310
  suspectScore: number | null;
171
311
  /** `null` when absent, for the same reasons as [[suspectScore]]. */
@@ -258,7 +398,7 @@ interface IdentifyResult {
258
398
  /**
259
399
  * `enriched`, or `unavailable` when the address could not be looked up.
260
400
  */
261
- state: string;
401
+ state: EventState | (string & {});
262
402
  /**
263
403
  * Weighted sum of the signals that fired, or `null` when unscored or hidden
264
404
  * by `hide_client_score` on public keys.
@@ -273,4 +413,4 @@ interface IdentifyResult {
273
413
  triggers?: IdentifyTrigger[];
274
414
  }
275
415
 
276
- export type { AbortSignalLike, CollectOptions, Confidence, ConsentState, EngineIdentity, FreshnessTicket, IdentifyOptions, IdentifyResult, IdentifySubmission, IdentifyTrigger, IncognitoDetection, IntegrityReport, Lie, LieKind, MobileFingerlyOptions, MobileIdentifyOptions, NativeIdentifyResult, RiskSignal, SdkPlatform, SignalOutcome, SignalReport, SignalStatus, SourceStage, SuspectLevel, TicketRequest };
416
+ export { type AbortSignalLike, type CollectOptions, Confidence, ConsentState, type EngineIdentity, EventState, type FreshnessTicket, type IdentifyOptions, type IdentifyResult, type IdentifySubmission, type IdentifyTrigger, IncognitoDetection, type IntegrityReport, type Lie, type LieKind, type MobileFingerlyOptions, type MobileIdentifyOptions, type NativeIdentifyResult, type RiskSignal, SdkPlatform, Signal, type SignalName, type SignalOutcome, type SignalReport, type SignalStatus, type SourceStage, SuspectLevel, type TicketRequest };
package/dist/index.js CHANGED
@@ -1 +1,113 @@
1
+ // src/index.ts
2
+ var SdkPlatform = {
3
+ Web: "web",
4
+ Android: "android",
5
+ Ios: "ios",
6
+ ReactNativeIos: "react-native-ios",
7
+ ReactNativeAndroid: "react-native-android",
8
+ FlutterIos: "flutter-ios",
9
+ FlutterAndroid: "flutter-android",
10
+ LynxIos: "lynx-ios",
11
+ LynxAndroid: "lynx-android"
12
+ };
13
+ var IncognitoDetection = {
14
+ Standard: "standard",
15
+ Extended: "extended"
16
+ };
17
+ var ConsentState = {
18
+ Granted: "granted",
19
+ Pending: "pending",
20
+ Denied: "denied"
21
+ };
22
+ var Confidence = {
23
+ Low: "low",
24
+ Medium: "medium",
25
+ High: "high"
26
+ };
27
+ var SuspectLevel = {
28
+ Low: "low",
29
+ Medium: "medium",
30
+ High: "high"
31
+ };
32
+ var Signal = {
33
+ Tor: "tor",
34
+ DatacenterProxy: "datacenter_proxy",
35
+ Proxy: "proxy",
36
+ DatacenterIp: "datacenter_ip",
37
+ ResidentialProxy: "residential_proxy",
38
+ ResidentialProxyLowConfidence: "residential_proxy_low_confidence",
39
+ ResidentialProxyMediumConfidence: "residential_proxy_medium_confidence",
40
+ ResidentialProxyHighConfidence: "residential_proxy_high_confidence",
41
+ Vpn: "vpn",
42
+ VpnPublic: "vpn_public",
43
+ VpnTimezone: "vpn_timezone",
44
+ VpnRelay: "vpn_relay",
45
+ VpnMobile: "vpn_mobile",
46
+ VpnOsMismatch: "vpn_os_mismatch",
47
+ VpnLowConfidence: "vpn_low_confidence",
48
+ VpnMediumConfidence: "vpn_medium_confidence",
49
+ VpnHighConfidence: "vpn_high_confidence",
50
+ IpBlocklist: "ip_blocklist",
51
+ IpBlocklistEmailSpam: "ip_blocklist_email_spam",
52
+ IpBlocklistAttackSource: "ip_blocklist_attack_source",
53
+ IpReputation: "ip_reputation",
54
+ IpAbuser: "ip_abuser",
55
+ NetworkAnomaly: "network_anomaly",
56
+ BogonIp: "bogon_ip",
57
+ AnycastIp: "anycast_ip",
58
+ LocationSpoofing: "location_spoofing",
59
+ GeoMismatch: "geo_mismatch",
60
+ IosSimulator: "ios_simulator",
61
+ Simulator: "simulator",
62
+ AndroidEmulator: "android_emulator",
63
+ Emulator: "emulator",
64
+ VirtualMachine: "virtual_machine",
65
+ JailbrokenDevice: "jailbroken_device",
66
+ Jailbreak: "jailbreak",
67
+ RootedDevice: "rooted_device",
68
+ RootApps: "root_apps",
69
+ PlayDeviceIntegrityFailed: "play_device_integrity_failed",
70
+ ClonedApp: "cloned_app",
71
+ AppCloner: "app_cloner",
72
+ PlayAppUnrecognized: "play_app_unrecognized",
73
+ DeviceFarm: "device_farm",
74
+ RepeatedReinstall: "repeated_reinstall",
75
+ DeviceActivityHigh: "device_activity_high",
76
+ DeviceActivityVeryHigh: "device_activity_very_high",
77
+ MitmAttack: "mitm_attack",
78
+ FridaDetected: "frida_detected",
79
+ Frida: "frida",
80
+ BrowserTampering: "browser_tampering",
81
+ Tampering: "tampering",
82
+ AntidetectBrowser: "antidetect_browser",
83
+ FingerprintSuppressed: "fingerprint_suppressed",
84
+ DeveloperTools: "developer_tools",
85
+ RemoteControl: "remote_control",
86
+ Bot: "bot",
87
+ Automation: "automation",
88
+ BadBot: "bad_bot",
89
+ FetchMetadataMissing: "fetch_metadata_missing",
90
+ WebTicketMissing: "web_ticket_missing",
91
+ WebTicketInvalid: "web_ticket_invalid",
92
+ HighActivity: "high_activity",
93
+ IncognitoMode: "incognito_mode",
94
+ Incognito: "incognito",
95
+ PrivacySettings: "privacy_settings",
96
+ EmbeddedWebView: "embedded_web_view",
97
+ ActiveCall: "active_call",
98
+ AttestationMissing: "attestation_missing",
99
+ AttestationFailed: "attestation_failed",
100
+ AttestationDowngrade: "attestation_downgrade",
101
+ DeviceInconsistent: "device_inconsistent",
102
+ ReportIncomplete: "report_incomplete",
103
+ ProbeErrors: "probe_errors",
104
+ CustomRootCa: "custom_root_ca",
105
+ SecondaryUserProfile: "secondary_user_profile"
106
+ };
107
+ var EventState = {
108
+ Pending: "pending",
109
+ Enriched: "enriched",
110
+ Unavailable: "unavailable"
111
+ };
1
112
 
113
+ export { Confidence, ConsentState, EventState, IncognitoDetection, SdkPlatform, Signal, SuspectLevel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fingerly/types",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },