@crvouga/mockingbird-service-recaptcha 0.1.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/CHANGELOG.md +5 -0
- package/DISCOVERY.md +55 -0
- package/README.md +67 -0
- package/SUPPORT.md +12 -0
- package/dist/chunk-OVXONL7Z.js +823 -0
- package/dist/chunk-OVXONL7Z.js.map +7 -0
- package/dist/chunk-RHPRBUVS.js +3198 -0
- package/dist/chunk-RHPRBUVS.js.map +7 -0
- package/dist/cli.js +19 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +947 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +7 -0
- package/dist/server.d.ts +1389 -0
- package/dist/server.js +12 -0
- package/dist/server.js.map +7 -0
- package/openapi.yaml +56 -0
- package/package.json +119 -0
package/CHANGELOG.md
ADDED
package/DISCOVERY.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @crvouga/mockingbird-service-recaptcha discovery
|
|
2
|
+
|
|
3
|
+
This is the installed-package index for coding agents and tooling. All relative links resolve
|
|
4
|
+
inside `node_modules/@crvouga/mockingbird-service-recaptcha/`; no repository checkout is needed to discover the mock's
|
|
5
|
+
supported surface or documented behavior.
|
|
6
|
+
|
|
7
|
+
## Capability and behavior sources
|
|
8
|
+
|
|
9
|
+
| Question | Authoritative file | What it contains |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Behaviour and integration | [`README.md`](README.md) | Routes, state transitions, auth, webhooks, controls, presets and deliberate omissions. |
|
|
12
|
+
| Exact capabilities | [`SUPPORT.md`](SUPPORT.md) | Supported, unsupported and parity-covered operations or commands, including reasons for gaps. |
|
|
13
|
+
| Wire contract | [`openapi.yaml`](openapi.yaml) | Machine-readable paths, methods, schemas, responses and parity annotations. |
|
|
14
|
+
| Public API | [`dist/index.d.ts`](dist/index.d.ts) | The installed package's exact TypeScript exports and signatures. |
|
|
15
|
+
| Package metadata | [`package.json`](package.json) | Runtime/entry-point claims, vendor links, parity scope/tier and `mockingbird.discovery`. |
|
|
16
|
+
|
|
17
|
+
Read these together: the contract/capability matrix says *what* is available, while the README
|
|
18
|
+
defines stateful behavior, lifecycle rules, test controls, and intentional oracle differences.
|
|
19
|
+
If prose and an executable surface disagree, report a parity mismatch instead of adding a
|
|
20
|
+
consumer-side workaround.
|
|
21
|
+
|
|
22
|
+
## Parity and oracle
|
|
23
|
+
|
|
24
|
+
- Declared parity surface: **v3 browser API and token verification**.
|
|
25
|
+
- Parity tier: **cold** (the repository controls when live checks run).
|
|
26
|
+
- Oracle: **Live vendor API or sandbox**.
|
|
27
|
+
- Repository command: `bun run parity:service -- recaptcha`.
|
|
28
|
+
- Evidence model: Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2.
|
|
29
|
+
|
|
30
|
+
The npm package contains evidence summaries and the exact contract, not credentials or the
|
|
31
|
+
repository-only parity harness. Self-parity/property and acceptance tests run in the Mockingbird
|
|
32
|
+
repository; live parity is an additional oracle check, not a substitute for the packaged matrix.
|
|
33
|
+
|
|
34
|
+
## Runtime introspection
|
|
35
|
+
|
|
36
|
+
- `GET /__admin/health`
|
|
37
|
+
- `GET /__admin`
|
|
38
|
+
- `GET /__admin/state`
|
|
39
|
+
- `GET /__admin/requests`
|
|
40
|
+
- `GET /__admin/metrics`
|
|
41
|
+
- `GET /__admin/faults/presets`
|
|
42
|
+
- `GET /__admin/ui`
|
|
43
|
+
|
|
44
|
+
For HTTP services, use `x-mockingbird-namespace` (or the documented credential/path carrier) so
|
|
45
|
+
parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
|
|
46
|
+
designed for assertions and diagnosis by consuming test suites.
|
|
47
|
+
|
|
48
|
+
## Report a mismatch or missing capability
|
|
49
|
+
|
|
50
|
+
Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
|
|
51
|
+
operation/command, a minimal redacted request, actual mock result, expected oracle result or vendor
|
|
52
|
+
documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
|
|
53
|
+
customer data, prompts, PHI, card data, or unredacted recordings.
|
|
54
|
+
|
|
55
|
+
Service key: `recaptcha`.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @crvouga/mockingbird-service-recaptcha
|
|
2
|
+
|
|
3
|
+
> Familiar calls. Faithful echoes. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
|
|
4
|
+
|
|
5
|
+
A WIP reCAPTCHA v3 mock: browser `grecaptcha.ready`/`execute`, deterministic single-use tokens,
|
|
6
|
+
and form-encoded Siteverify. The contract follows Google's [verification](https://developers.google.com/recaptcha/docs/verify)
|
|
7
|
+
and [v3](https://developers.google.com/recaptcha/docs/v3) references. It does not contact Google.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bun add @crvouga/mockingbird-service-recaptcha
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createRuntime } from "@crvouga/mockingbird-service-recaptcha"
|
|
19
|
+
|
|
20
|
+
const runtime = createRuntime()
|
|
21
|
+
const issued = await runtime.fetch(new Request("http://mock.test/__admin/issue", {
|
|
22
|
+
method: "POST",
|
|
23
|
+
headers: { "content-type": "application/json" },
|
|
24
|
+
body: JSON.stringify({ siteKey: "mock_site", action: "login", hostname: "app.example" }),
|
|
25
|
+
}))
|
|
26
|
+
const { token } = await issued.json()
|
|
27
|
+
const verified = await runtime.fetch(new Request("http://mock.test/recaptcha/api/siteverify", {
|
|
28
|
+
method: "POST",
|
|
29
|
+
body: new URLSearchParams({ secret: "mock_secret", response: token }),
|
|
30
|
+
}))
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For HTTP, use `createServer` from the `/server` entry or `mockingbird-recaptcha serve`.
|
|
34
|
+
Override the browser script URL to `/recaptcha/api.js?render=mock_site` and the server
|
|
35
|
+
verification URL to `/recaptcha/api/siteverify` on the local origin. The browser shim
|
|
36
|
+
uses a local `/__admin/issue` request to obtain tokens; an admin-key-protected runtime
|
|
37
|
+
requires tokens to be provisioned by the test harness. No admin key is embedded in script.
|
|
38
|
+
|
|
39
|
+
Tokens bind a site key, hostname, action, score, and issue time. Verification consumes
|
|
40
|
+
them once and expires them after two minutes. A low score is still a successful vendor
|
|
41
|
+
verification: the application checks its score threshold, expected action, and hostname.
|
|
42
|
+
|
|
43
|
+
`PUT /__admin/settings` accepts `sites`, `score`, per-action `scores`, response `action`/
|
|
44
|
+
`hostname` overrides, `executeError`, `expired`, `replayed`, and `errorCodes`.
|
|
45
|
+
`GET /__admin/attempts` returns only time/result/error metadata, without tokens or secrets.
|
|
46
|
+
Shared admin routes provide clock control, reset, Timeline history, namespaces, and faults.
|
|
47
|
+
Namespace selection uses `x-mockingbird-namespace` or `/__admin/ns/<name>/…`.
|
|
48
|
+
Custom `adminPrefix` relocates issuance and the shim's local target together.
|
|
49
|
+
|
|
50
|
+
Presets: `human`, `bot`, `threshold_boundary`, `expired`, `replayed`, `script_failure`,
|
|
51
|
+
`rate_limited`, and `server_error`. Pass `count: 1` for a one-shot failure. Generic faults
|
|
52
|
+
also support deterministic latency and connection drops. No webhook or pagination exists
|
|
53
|
+
in this vendor surface.
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
The main entry exports `RecaptchaAPI`, `RecaptchaState`, `createRuntime`,
|
|
58
|
+
`RECAPTCHA_NAMESPACE`, `RECAPTCHA_PRESETS`, `DEFAULT_SETTINGS`, `document`,
|
|
59
|
+
`operationIds`, and `supportedOperationIds`, plus public types.
|
|
60
|
+
The `/server` entry exports `createServer`, `serveTarget`, and `DEFAULT_PORT`.
|
|
61
|
+
|
|
62
|
+
## Deliberately not modelled
|
|
63
|
+
|
|
64
|
+
- Google's risk model, device fingerprinting, interactive v2 challenges, or Enterprise API.
|
|
65
|
+
- The private Geviti client's implementation: acceptance uses the documented Google flow.
|
|
66
|
+
- Live successful challenges. The cold parity command probes only missing-response rejection
|
|
67
|
+
and exits 2 without `RECAPTCHA_SECRET_KEY`; never use production credentials in fixtures.
|
package/SUPPORT.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# reCAPTCHA v3 — operation support
|
|
2
|
+
|
|
3
|
+
Generated from `openapi.yaml`; do not edit by hand.
|
|
4
|
+
|
|
5
|
+
- operations in spec: **2**
|
|
6
|
+
- supported by the mock: **2**
|
|
7
|
+
- parity enabled: **1**
|
|
8
|
+
|
|
9
|
+
| operationId | route | mock | parity | notes |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| `BrowserScript` | `GET /recaptcha/api.js` | ✅ supported | ❌ disabled | Semantic shim |
|
|
12
|
+
| `Siteverify` | `POST /recaptcha/api/siteverify` | ✅ supported | ✅ | |
|