@fingerly/types 0.1.2 → 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 +103 -4
- package/dist/index.cjs +119 -0
- package/dist/index.d.cts +265 -251
- package/dist/index.d.ts +265 -251
- package/dist/index.js +112 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://fingerly.io">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/fingerly-io/.github/main/assets/logo-dark.svg">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/fingerly-io/.github/main/assets/logo-light.svg" alt="Fingerly" height="44">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
2
9
|
|
|
3
|
-
The canonical TypeScript contracts shared by Fingerly's browser and mobile SDKs
|
|
10
|
+
<p align="center"><b>Fingerly shared TypeScript types</b><br>The canonical TypeScript contracts shared by Fingerly's browser and mobile SDKs.</p>
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/@fingerly/types"><img src="https://img.shields.io/npm/v/@fingerly/types?style=flat-square" alt="npm version"></a>
|
|
14
|
+
<a href="https://github.com/fingerly-io/sdk-types/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/fingerly-io/sdk-types/ci.yml?branch=main&style=flat-square&label=ci" alt="CI"></a>
|
|
15
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/fingerly-io/sdk-types?style=flat-square" alt="License"></a>
|
|
16
|
+
<a href="https://docs.fingerly.io/docs/sdks"><img src="https://img.shields.io/badge/docs-docs.fingerly.io-blue?style=flat-square" alt="Documentation"></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center"><img src="https://raw.githubusercontent.com/fingerly-io/.github/main/assets/banner.webp" alt="Fingerly" width="100%"></p>
|
|
20
|
+
|
|
21
|
+
## What is this
|
|
22
|
+
|
|
23
|
+
`@fingerly/types` holds the canonical TypeScript `v: 3` wire contracts that every Fingerly client
|
|
24
|
+
SDK agrees on: what a browser or an app submits and what the Fingerly API answers. It is shared by
|
|
25
|
+
the browser SDKs (`@fingerly/core`, `@fingerly/web-js`, and the framework bindings) and the
|
|
26
|
+
TypeScript mobile bridges (`@fingerly/react-native`, `@fingerly/lynx`).
|
|
27
|
+
[Fingerly](https://fingerly.io) is device intelligence for fraud prevention.
|
|
28
|
+
|
|
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
|
|
32
|
+
the Fingerly server. Stored events are read server-side with a secret key, so their types live in
|
|
33
|
+
the server SDKs. You do not need this package to use Fingerly: the browser and framework packages
|
|
34
|
+
already depend on it. Install it when you want to type your own code against the same shapes.
|
|
35
|
+
|
|
36
|
+
## Getting started
|
|
37
|
+
|
|
38
|
+
1. Prerequisites: a Fingerly account and a project key. See
|
|
39
|
+
[API keys](https://docs.fingerly.io/docs/api-keys).
|
|
40
|
+
2. Install:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install -D @fingerly/types@^0.4.0
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. Import the types and constants you need:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { SuspectLevel, type IdentifyResult } from '@fingerly/types'
|
|
50
|
+
|
|
51
|
+
function describe(result: IdentifyResult): string {
|
|
52
|
+
if (result.suspectLevel === SuspectLevel.High) return `${result.visitorId}: review`
|
|
53
|
+
return `${result.visitorId}: ${result.suspectLevel ?? 'not scored'}`
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The package ships ESM and CommonJS entry points with declarations (`dist` only).
|
|
58
|
+
|
|
59
|
+
## What lives here
|
|
60
|
+
|
|
61
|
+
- **Single-pass `v: 3` ingest envelope (`IdentifySubmission`):** `v: 3`, `sdk`,
|
|
62
|
+
`consent`, `signals` (`SignalReport` carrying `schema`, `budget_ms`,
|
|
63
|
+
`elapsed_ms`, `sources`, and `integrity`), and optional `tag`, `ticket` and
|
|
64
|
+
`ticket_pow`.
|
|
65
|
+
- **Web freshness ticket (`TicketRequest`, `FreshnessTicket`):** the
|
|
66
|
+
`op: 'ticket'` request body and the `{ ticket, expires_at, pow_bits? }`
|
|
67
|
+
answer, also returned as `next_ticket` on a web identification answer.
|
|
68
|
+
- **Collection options (`CollectOptions`, `IdentifyOptions`):** `signal`
|
|
69
|
+
(`AbortSignalLike`), `incognitoDetection: 'standard' | 'extended'`, and `tag`.
|
|
70
|
+
- **1-RTT server answer (`IdentifyResult`, `NativeIdentifyResult`):** `requestId`,
|
|
71
|
+
`visitorId` (`""` with `visitorIsNew: false` whenever `identifiable === false`,
|
|
72
|
+
inside an embedded WebView, or on high-risk unmatched Web traffic),
|
|
73
|
+
`visitorConfidence`, `identifiable`, `duplicate`, `state`, `suspectScore`
|
|
74
|
+
and `suspectLevel`. The signal report is what `collect()` returns.
|
|
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.
|
|
7
85
|
|
|
8
86
|
## Development
|
|
9
87
|
|
|
88
|
+
This repository is mounted in the [`sdks`](https://github.com/fingerly-io/sdks) monorepo at
|
|
89
|
+
`client/web/types`, where the package is built and published.
|
|
90
|
+
|
|
10
91
|
```sh
|
|
11
92
|
pnpm install
|
|
12
93
|
pnpm lint
|
|
13
94
|
pnpm build
|
|
95
|
+
pnpm test
|
|
14
96
|
```
|
|
97
|
+
|
|
98
|
+
`pnpm lint` also type-checks `tests/`, which needs `@types/node`; that package only comes from the
|
|
99
|
+
`sdks` workspace, so run lint there.
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
See the [SDK overview](https://docs.fingerly.io/docs/sdks) on docs.fingerly.io and the
|
|
104
|
+
[API reference](https://docs.fingerly.io/reference/overview).
|
|
105
|
+
|
|
106
|
+
## Help
|
|
107
|
+
|
|
108
|
+
Open an issue on this repository, or write to [support@fingerly.io](mailto:support@fingerly.io).
|
|
109
|
+
Security issues: [security@fingerly.io](mailto:security@fingerly.io).
|
|
110
|
+
|
|
111
|
+
## Licence
|
|
112
|
+
|
|
113
|
+
Apache-2.0, see [LICENSE](LICENSE).
|
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;
|