@danetix/sentinel 1.0.0 → 1.0.1
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 +90 -171
- package/dist/stl.cjs.min.js +1 -1
- package/dist/stl.esm.min.js +1 -1
- package/dist/stl.min.js +1 -1
- package/dist/stl.umd.min.js +1 -1
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -1,217 +1,136 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://danetix.com">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://danetix.com/logo-white.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://danetix.com/logo-dark.svg">
|
|
6
|
+
<img src="https://danetix.com/logo-dark.svg" alt="Danetix" width="260">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h3 align="center">Device Intelligence SDK</h3>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
Generates a stable device identifier that persists across sessions, tabs, and browsing modes.
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://www.npmjs.com/package/@danetix/sentinel"><img src="https://img.shields.io/npm/v/@danetix/sentinel.svg" alt="npm"></a>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@danetix/sentinel"><img src="https://img.shields.io/npm/dm/@danetix/sentinel.svg" alt="downloads"></a>
|
|
20
|
+
<a href="https://www.npmjs.com/package/@danetix/sentinel"><img src="https://img.shields.io/bundlephobia/minzip/@danetix/sentinel" alt="size"></a>
|
|
21
|
+
</p>
|
|
2
22
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **155+ browser signals** — canvas, audio, WebGL, WebGPU, fonts, and more
|
|
8
|
-
- **Bot detection** — headless browsers, automation tools, CDP, Playwright, Puppeteer
|
|
9
|
-
- **Anti-tamper** — proxy detection, descriptor integrity, prototype chain validation
|
|
10
|
-
- **Anti-detect browser detection** — Multilogin, GoLogin, AdsPower
|
|
11
|
-
- **Self-contained** — zero runtime dependencies, ~60KB gzipped
|
|
12
|
-
- **All formats** — IIFE, ESM, CJS, UMD
|
|
23
|
+
---
|
|
13
24
|
|
|
14
|
-
##
|
|
25
|
+
## Get Started
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
<script type="module">
|
|
18
|
-
const sentinel = import('https://your-domain.com/stl.esm.min.js')
|
|
19
|
-
.then(S => S.start({
|
|
20
|
-
apiKey: 'YOUR_API_KEY',
|
|
21
|
-
endpoint: 'https://your-domain.com/ingest'
|
|
22
|
-
}))
|
|
27
|
+
Create a free account at **[danetix.com](https://danetix.com)** to get your API key.
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
.then(s => s.get())
|
|
26
|
-
.then(result => {
|
|
27
|
-
console.log(result.requestId)
|
|
28
|
-
console.log(result.deviceId)
|
|
29
|
-
})
|
|
30
|
-
</script>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Installation
|
|
29
|
+
### NPM
|
|
34
30
|
|
|
35
31
|
```bash
|
|
36
32
|
npm install @danetix/sentinel
|
|
37
|
-
# or
|
|
38
|
-
pnpm add @danetix/sentinel
|
|
39
|
-
# or
|
|
40
|
-
yarn add @danetix/sentinel
|
|
41
33
|
```
|
|
42
34
|
|
|
43
|
-
## Usage
|
|
44
|
-
|
|
45
|
-
### ESM (recommended)
|
|
46
|
-
|
|
47
35
|
```js
|
|
48
|
-
import
|
|
36
|
+
import Sentinel from '@danetix/sentinel'
|
|
49
37
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
// Initialize at application startup
|
|
39
|
+
const stl = Sentinel.start({
|
|
40
|
+
apiKey: 'your-api-key',
|
|
41
|
+
endpoint: 'https://your-domain.com/ingest'
|
|
54
42
|
})
|
|
55
43
|
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
// Get the device identifier when you need it
|
|
45
|
+
const result = await stl.get()
|
|
46
|
+
console.log(result.deviceId) // → "Abs2d8F0gTk9l..."
|
|
58
47
|
```
|
|
59
48
|
|
|
60
|
-
###
|
|
49
|
+
### CDN
|
|
61
50
|
|
|
62
51
|
```html
|
|
63
|
-
<script src="https://your-domain.com/stl.min.js"></script>
|
|
64
52
|
<script>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
53
|
+
const stlPromise = import('https://your-domain.com/stl.esm.min.js')
|
|
54
|
+
.then(S => S.start({
|
|
55
|
+
apiKey: 'your-api-key',
|
|
56
|
+
endpoint: '/ingest'
|
|
57
|
+
}))
|
|
58
|
+
|
|
59
|
+
stlPromise
|
|
60
|
+
.then(stl => stl.get())
|
|
61
|
+
.then(result => console.log(result.deviceId))
|
|
73
62
|
</script>
|
|
74
63
|
```
|
|
75
64
|
|
|
76
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Caching
|
|
68
|
+
|
|
69
|
+
Enable caching to avoid redundant requests in single-page applications:
|
|
77
70
|
|
|
78
71
|
```js
|
|
79
|
-
const
|
|
80
|
-
apiKey: '
|
|
72
|
+
const stl = Sentinel.start({
|
|
73
|
+
apiKey: 'your-api-key',
|
|
81
74
|
endpoint: '/ingest',
|
|
82
|
-
cache: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
router.afterEach(() => {
|
|
87
|
-
sentinel.get()
|
|
75
|
+
cache: {
|
|
76
|
+
ttl: 300, // seconds
|
|
77
|
+
location: 'sessionStorage' // or 'memory' (default), 'localStorage'
|
|
78
|
+
}
|
|
88
79
|
})
|
|
89
|
-
|
|
90
|
-
// Force fresh request
|
|
91
|
-
sentinel.get({ ignoreCache: true })
|
|
92
|
-
|
|
93
|
-
// Clear cache manually
|
|
94
|
-
sentinel.clearCache()
|
|
95
80
|
```
|
|
96
81
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
| Option | Type | Default | Description |
|
|
104
|
-
|--------|------|---------|-------------|
|
|
105
|
-
| `apiKey` | `string` | *required* | Workspace API key |
|
|
106
|
-
| `endpoint` | `string` | *required* | Ingest endpoint URL |
|
|
107
|
-
| `cache` | `CacheOptions` | — | Enable result caching |
|
|
108
|
-
| `cache.ttl` | `number` | `0` | Cache TTL in seconds |
|
|
109
|
-
| `cache.location` | `'memory' \| 'localStorage' \| 'sessionStorage'` | `'memory'` | Cache storage |
|
|
110
|
-
| `debug` | `boolean` | `false` | Enable debug logging |
|
|
111
|
-
| `proxyDetection` | `'light' \| 'high'` | `'high'` | Anti-detect detection mode |
|
|
112
|
-
|
|
113
|
-
### `SentinelInstance.get(options?): Promise<CaptureResult>`
|
|
114
|
-
|
|
115
|
-
Capture device signals, send to endpoint, return result.
|
|
116
|
-
|
|
117
|
-
| Option | Type | Description |
|
|
118
|
-
|--------|------|-------------|
|
|
119
|
-
| `ignoreCache` | `boolean` | Skip cache, force fresh request |
|
|
120
|
-
| `linkedId` | `string` | Custom identifier (user login, order ID) |
|
|
121
|
-
| `tag` | `Record<string, unknown>` | Custom metadata |
|
|
122
|
-
|
|
123
|
-
### `SentinelInstance.clearCache(): void`
|
|
124
|
-
|
|
125
|
-
Clear cached result. Next `.get()` will make a fresh request.
|
|
126
|
-
|
|
127
|
-
### `CaptureResult`
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
{
|
|
131
|
-
requestId: string // Unique event ID
|
|
132
|
-
deviceId: string // Stable device identifier
|
|
133
|
-
signedDeviceToken: string // Signed token for persistence
|
|
134
|
-
}
|
|
82
|
+
```js
|
|
83
|
+
await stl.get() // → server request
|
|
84
|
+
await stl.get() // → instant (cached)
|
|
85
|
+
await stl.get({ ignoreCache: true }) // → force fresh request
|
|
86
|
+
stl.clearCache() // → invalidate manually
|
|
135
87
|
```
|
|
136
88
|
|
|
137
|
-
## Browser Support
|
|
138
|
-
|
|
139
|
-
| Browser | Version |
|
|
140
|
-
|---------|---------|
|
|
141
|
-
| Chrome | 80+ |
|
|
142
|
-
| Firefox | 113+ |
|
|
143
|
-
| Safari | 16.4+ |
|
|
144
|
-
| Edge | 80+ |
|
|
145
|
-
| Samsung Internet | 14+ |
|
|
146
|
-
|
|
147
|
-
## Bundle Sizes
|
|
148
|
-
|
|
149
|
-
| Format | File | Size | Gzipped |
|
|
150
|
-
|--------|------|------|---------|
|
|
151
|
-
| IIFE | `stl.min.js` | 190 KB | ~60 KB |
|
|
152
|
-
| ESM | `stl.esm.min.js` | 196 KB | ~62 KB |
|
|
153
|
-
| CJS | `stl.cjs.min.js` | 196 KB | ~62 KB |
|
|
154
|
-
| UMD | `stl.umd.min.js` | 190 KB | ~60 KB |
|
|
155
|
-
|
|
156
|
-
## License
|
|
157
|
-
|
|
158
|
-
Proprietary. See LICENSE for details.
|
|
159
|
-
|
|
160
89
|
---
|
|
161
90
|
|
|
162
|
-
|
|
91
|
+
## API Reference
|
|
163
92
|
|
|
164
|
-
|
|
93
|
+
### `Sentinel.start(options)`
|
|
165
94
|
|
|
166
|
-
|
|
95
|
+
Returns a `SentinelInstance`.
|
|
167
96
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}))
|
|
97
|
+
| Parameter | Type | Required | Description |
|
|
98
|
+
|:----------|:-----|:---------|:------------|
|
|
99
|
+
| `apiKey` | `string` | Yes | Your API key |
|
|
100
|
+
| `endpoint` | `string` | Yes | Ingest endpoint URL |
|
|
101
|
+
| `cache.ttl` | `number` | — | Cache lifetime in seconds |
|
|
102
|
+
| `cache.location` | `string` | — | `'memory'` \| `'localStorage'` \| `'sessionStorage'` |
|
|
175
103
|
|
|
176
|
-
|
|
177
|
-
.then(s => s.get())
|
|
178
|
-
.then(result => {
|
|
179
|
-
console.log(result.requestId)
|
|
180
|
-
console.log(result.deviceId)
|
|
181
|
-
})
|
|
182
|
-
</script>
|
|
183
|
-
```
|
|
104
|
+
### `stl.get(options?)`
|
|
184
105
|
|
|
185
|
-
|
|
106
|
+
Returns `Promise<Result>`.
|
|
186
107
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
108
|
+
| Parameter | Type | Description |
|
|
109
|
+
|:----------|:-----|:------------|
|
|
110
|
+
| `ignoreCache` | `boolean` | Skip cache |
|
|
111
|
+
| `linkedId` | `string` | Link to your own user/session ID |
|
|
112
|
+
| `tag` | `object` | Attach custom metadata |
|
|
190
113
|
|
|
191
|
-
|
|
114
|
+
### Result
|
|
192
115
|
|
|
193
116
|
```js
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
cache: { ttl: 300, location: 'sessionStorage' }
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
// Вызывать при каждой смене роута
|
|
203
|
-
router.afterEach(() => sentinel.get())
|
|
117
|
+
{
|
|
118
|
+
requestId: "abc123...", // unique event ID
|
|
119
|
+
deviceId: "Abs2d8F0gTk9l...", // stable device identifier
|
|
120
|
+
signedDeviceToken: "eyJ..." // signed token for verification
|
|
121
|
+
}
|
|
204
122
|
```
|
|
205
123
|
|
|
206
|
-
|
|
124
|
+
---
|
|
207
125
|
|
|
208
|
-
|
|
209
|
-
|-------|-----|----------|
|
|
210
|
-
| `ttl` | `number` | Время жизни кеша в секундах |
|
|
211
|
-
| `location` | `'memory' \| 'localStorage' \| 'sessionStorage'` | Где хранить кеш |
|
|
126
|
+
## Browser Support
|
|
212
127
|
|
|
213
|
-
|
|
128
|
+
| | Chrome | Firefox | Safari | Edge | Samsung Internet |
|
|
129
|
+
|:-|:------:|:-------:|:------:|:----:|:----------------:|
|
|
130
|
+
| **Version** | 80+ | 113+ | 16.4+ | 80+ | 14+ |
|
|
214
131
|
|
|
215
|
-
|
|
132
|
+
---
|
|
216
133
|
|
|
217
|
-
|
|
134
|
+
<p align="center">
|
|
135
|
+
<sub>Copyright © 2026 Danetix. All rights reserved.</sub>
|
|
136
|
+
</p>
|