@maggidev/captchashield 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 +9 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<p>Cloudflare Turnstile modal for browser applications with secure defaults, optional backend verification, and a dedicated local demo lab.</p>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@maggidev/captchashield)
|
|
8
|
+
[](https://www.npmjs.com/package/@maggidev/captchashield)
|
|
9
|
+
[](https://bundlephobia.com/package/@maggidev/captchashield)
|
|
10
10
|
[](https://github.com/N0tMaggi/CapchaShield/actions/workflows/ci.yml)
|
|
11
11
|
[](#api-at-a-glance)
|
|
12
12
|
[](LICENSE)
|
|
@@ -58,6 +58,8 @@ Then open:
|
|
|
58
58
|
|
|
59
59
|
[http://127.0.0.1:4173/demo/](http://127.0.0.1:4173/demo/)
|
|
60
60
|
|
|
61
|
+
> **No Cloudflare account needed for local testing.** The demo ships with a built-in mock Turnstile widget that fires the token callback immediately. You can also use Cloudflare's [public test site keys](https://developers.cloudflare.com/turnstile/troubleshooting/testing/) (`1x00000000000000000000AA` always passes, `2x00000000000000000000AB` always blocks) against the real Turnstile script.
|
|
62
|
+
|
|
61
63
|
The demo page includes:
|
|
62
64
|
|
|
63
65
|
- default modal and custom renderer flows
|
|
@@ -156,13 +158,13 @@ stateDiagram-v2
|
|
|
156
158
|
## Install
|
|
157
159
|
|
|
158
160
|
```bash
|
|
159
|
-
npm install captchashield
|
|
161
|
+
npm install @maggidev/captchashield
|
|
160
162
|
```
|
|
161
163
|
|
|
162
164
|
## Quick Start
|
|
163
165
|
|
|
164
166
|
```ts
|
|
165
|
-
import { createCaptchaShield } from 'captchashield';
|
|
167
|
+
import { createCaptchaShield } from '@maggidev/captchashield';
|
|
166
168
|
|
|
167
169
|
const shield = createCaptchaShield({
|
|
168
170
|
siteKey: '<your-turnstile-sitekey>',
|
|
@@ -180,6 +182,8 @@ const shield = createCaptchaShield({
|
|
|
180
182
|
await shield.open();
|
|
181
183
|
```
|
|
182
184
|
|
|
185
|
+
The `verify.endpoint` receives a `POST` request with `Content-Type: application/json` and body `{ "token": "<turnstile-token>" }`. Any `2xx` response is treated as success; anything else triggers `onError`.
|
|
186
|
+
|
|
183
187
|
By default, verified state is session-local. Persistent skip via cookie only happens when `cookie.trustClientCookie` is enabled.
|
|
184
188
|
|
|
185
189
|
## Security Model
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggidev/captchashield",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Customizable Cloudflare Turnstile modal with secure defaults and optional client-cookie skip logic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
16
17
|
"import": "./dist/index.mjs",
|
|
17
18
|
"require": "./dist/index.cjs"
|
|
18
19
|
},
|