@hideguard/sdk 0.0.0-stage → 1.11.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/LICENSE +44 -0
- package/README.md +62 -2
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.mjs +2 -0
- package/package.json +39 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
HideGuard Browser SDK License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hideguard, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This license governs the software distributed as the npm package "@hideguard/sdk" and as the
|
|
6
|
+
files served at https://hideguard.io/sdk/ (the "SDK"). The SDK is licensed, not sold.
|
|
7
|
+
|
|
8
|
+
1. Grant. Subject to the terms below and to the HideGuard Terms of Service
|
|
9
|
+
(https://hideguard.io/terms, the "Terms"), Hideguard, Inc. ("HideGuard") grants you a
|
|
10
|
+
non-exclusive, non-transferable, revocable license to:
|
|
11
|
+
(a) install and use the SDK solely to send data to, and receive results from, the HideGuard
|
|
12
|
+
service under an account you hold in good standing; and
|
|
13
|
+
(b) reproduce and distribute the SDK, unmodified, only as part of a website or application
|
|
14
|
+
that uses it as described in (a).
|
|
15
|
+
|
|
16
|
+
2. Restrictions. Except to the extent applicable law expressly permits it despite this
|
|
17
|
+
limitation, you must not, and must not permit anyone else to:
|
|
18
|
+
(a) modify, adapt, translate or create derivative works of the SDK;
|
|
19
|
+
(b) decompile, disassemble, deobfuscate or otherwise reverse engineer the SDK, or attempt to
|
|
20
|
+
derive its source code, its measurements or the detection methods it implements;
|
|
21
|
+
(c) use the SDK, or any part of it, with any service other than HideGuard, or to build,
|
|
22
|
+
train, test or benchmark a competing product or a product designed to evade detection;
|
|
23
|
+
(d) distribute the SDK on its own, as a library, or other than as described in section 1(b);
|
|
24
|
+
(e) sell, rent, lease, sublicense or otherwise make the SDK available to a third party except
|
|
25
|
+
as described in section 1(b); or
|
|
26
|
+
(f) remove or alter any copyright, license or proprietary notice in the SDK.
|
|
27
|
+
|
|
28
|
+
3. Ownership. HideGuard and its licensors own the SDK and all intellectual property rights in it.
|
|
29
|
+
All rights not expressly granted in this license are reserved.
|
|
30
|
+
|
|
31
|
+
4. Termination. This license ends automatically when your HideGuard account ends or when you
|
|
32
|
+
breach it. On termination you must stop using the SDK and remove it from your websites and
|
|
33
|
+
applications within a reasonable time.
|
|
34
|
+
|
|
35
|
+
5. Disclaimer. THE SDK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
36
|
+
INCLUDING THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
37
|
+
NON-INFRINGEMENT, EXCEPT AS THE TERMS EXPRESSLY PROVIDE.
|
|
38
|
+
|
|
39
|
+
6. Limitation of liability. TO THE EXTENT PERMITTED BY LAW, AND EXCEPT AS THE TERMS EXPRESSLY
|
|
40
|
+
PROVIDE, HIDEGUARD IS NOT LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM OR IN
|
|
41
|
+
CONNECTION WITH THE SDK OR ITS USE.
|
|
42
|
+
|
|
43
|
+
7. Order of precedence and law. If this license and the Terms conflict, the Terms prevail. This
|
|
44
|
+
license is governed by the law that governs the Terms.
|
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hideguard/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The HideGuard browser SDK as a module, for apps that bundle their dependencies: a single-page app,
|
|
4
|
+
or an Electron renderer that must not load remote scripts. It is the same collector as the
|
|
5
|
+
`<script src="https://hideguard.io/sdk/v1.js">` tag, configured the same way.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hideguard/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { start } from '@hideguard/sdk'
|
|
13
|
+
|
|
14
|
+
// Once per page, with the site's PUBLIC key (pk_…). Never the secret key.
|
|
15
|
+
const hideguard = start({ siteKey: 'pk_live_…', block: false })
|
|
16
|
+
|
|
17
|
+
// When the visitor is about to pay:
|
|
18
|
+
let requestId: string | null = null
|
|
19
|
+
try {
|
|
20
|
+
;({ requestId } = await hideguard.get())
|
|
21
|
+
} catch {
|
|
22
|
+
// A failed reading must never stop a checkout.
|
|
23
|
+
}
|
|
24
|
+
await fetch('/checkout', { method: 'POST', headers: { 'X-HideGuard-Request-Id': requestId ?? '' } /* … */ })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Your server then asks for the verdict with the secret key — `POST /api/v1/verdict`, or
|
|
28
|
+
[`@hideguard/node`](https://www.npmjs.com/package/@hideguard/node). Never act on the verdict in the
|
|
29
|
+
page: the visitor controls the page.
|
|
30
|
+
|
|
31
|
+
Without a bundler, the same API is one import away, always the latest 1.x:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const { start } = await import('https://hideguard.io/sdk/v1.mjs')
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
| Option | Default | |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `siteKey` | — | The site's public key. Required. |
|
|
42
|
+
| `endpoint` | `https://hideguard.io` | The collector's origin. |
|
|
43
|
+
| `auto` | `false` | Collect as soon as the page is ready, instead of on `get()`. |
|
|
44
|
+
| `block` | reply decides | `false` never draws the block screen; `true` draws it on every block. |
|
|
45
|
+
| `cookie`, `heartbeat`, `behavior`, `localIp` | `true` | `false` turns each off. |
|
|
46
|
+
| `requests` | `false` | Records the page's own `fetch`/XHR requests. Opt-in. |
|
|
47
|
+
| `synCheck`, `latencyCheck` | HideGuard's hosts | `false` turns each off; a URL names your own host. |
|
|
48
|
+
|
|
49
|
+
`start()` boots one collector per page: a second call returns the same agent, and a call with a
|
|
50
|
+
different site key throws. Importing the package is safe during server rendering; `start()` runs
|
|
51
|
+
only in a browser.
|
|
52
|
+
|
|
53
|
+
## Electron
|
|
54
|
+
|
|
55
|
+
Serve the renderer however you like. Pages loaded from disk (`loadFile`) send `Origin: null`;
|
|
56
|
+
declare the site as a **Desktop app** in the HideGuard dashboard and it is accepted, with no
|
|
57
|
+
origin to list. Add `https://hideguard.io` and `https://syn.hideguard.io` to your CSP's
|
|
58
|
+
`connect-src`.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Proprietary. Use only with the HideGuard service, unmodified; see [LICENSE](LICENSE) and the
|
|
63
|
+
[HideGuard Terms of Service](https://hideguard.io/terms).
|