@sentinelsup/sdk 0.1.0 → 0.1.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 +8 -3
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,13 +60,18 @@ Get a free API key (no credit card) at [sntlhq.com/signup](https://sntlhq.com/si
|
|
|
60
60
|
|
|
61
61
|
## Frontend setup
|
|
62
62
|
|
|
63
|
-
Add the
|
|
63
|
+
Add the Sentinel Edge SDK to your frontend so Sentinel can collect the token:
|
|
64
64
|
|
|
65
65
|
```html
|
|
66
|
-
<script async src="https://
|
|
66
|
+
<script async src="https://sntlhq.com/assets/edge.js" id="_mcl"></script>
|
|
67
|
+
|
|
68
|
+
<!-- Add class="monocle-enriched" to any form you want evaluated -->
|
|
69
|
+
<form class="monocle-enriched" id="checkout-form">
|
|
70
|
+
<!-- The SDK injects: <input type="hidden" name="monocle" value="eyJ..."> -->
|
|
71
|
+
</form>
|
|
67
72
|
```
|
|
68
73
|
|
|
69
|
-
Read the token from the
|
|
74
|
+
Read the token from the injected form field and send it to your backend:
|
|
70
75
|
|
|
71
76
|
```js
|
|
72
77
|
const token = document.querySelector('input[name="monocle"]').value;
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Sentinel fraud detection API at https://sntlhq.com/v1/evaluate.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* const Sentinel = require('@
|
|
6
|
+
* const Sentinel = require('@sentinelsup/sdk');
|
|
7
7
|
* const sentinel = new Sentinel({ apiKey: process.env.SENTINEL_KEY });
|
|
8
8
|
* const result = await sentinel.evaluate({ token });
|
|
9
9
|
* if (result.isSuspicious) return res.status(403).end();
|
package/package.json
CHANGED