@domandigital/synthetic 0.2.0 → 0.2.2
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 +12 -0
- package/README.md +7 -7
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @domandigital/synthetic
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e4db92a: The README examples, code comments and changelog entries no longer name clients. They describe the site instead, for example "a client electrician site". No runtime behaviour changes.
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0dba997: Sites made with create-site deploy their preview to Cloudflare only. `scripts/gates/deploy-preview.mjs` no longer has a Vercel branch or looks for `.vercel/project.json`, `preview.host` in `site.programme.json` is `cloudflare` or null, the `host` answer prompt suggests `cloudflare`, and `docs/site-programme.md` and the README say so. A site that still sets `preview.host` to `vercel` now stops at Stage 06 with a message naming the host; remove the key or set it to `cloudflare`. The synthetic README and a craft comment no longer name Vercel; no behaviour changes in those two.
|
|
14
|
+
|
|
3
15
|
## 0.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@ Checks (`dd-checks`) submits a real enquiry through a client's real form
|
|
|
5
5
|
handler on a schedule; Turnstile blocks synthetic browsers, so the handler
|
|
6
6
|
accepts a signed request that skips **only the Turnstile token**.
|
|
7
7
|
|
|
8
|
-
Web Crypto only, no dependencies: it runs in Cloudflare Workers, Node 22
|
|
9
|
-
|
|
8
|
+
Web Crypto only, no dependencies: it runs in Cloudflare Workers, Node 22+
|
|
9
|
+
and the browser-side signing helpers in dd-checks. Tests run in both
|
|
10
10
|
Node and workerd.
|
|
11
11
|
|
|
12
12
|
The protocol is specified in the "DD Checks: plan" document on DOM-487,
|
|
@@ -85,11 +85,11 @@ node -e "console.log(require('node:crypto').randomBytes(32).toString('base64url'
|
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
87
|
const { headers, runId } = await sign({
|
|
88
|
-
key: { kid: "
|
|
89
|
-
url: "https://www.
|
|
88
|
+
key: { kid: "example-2026-10", secret },
|
|
89
|
+
url: "https://www.example.co.uk/api/enquiry",
|
|
90
90
|
contentType: "application/json",
|
|
91
91
|
body: rawBodyString,
|
|
92
|
-
client: "
|
|
92
|
+
client: "example", form: "enquiry", mode: "probe",
|
|
93
93
|
});
|
|
94
94
|
```
|
|
95
95
|
|
|
@@ -139,7 +139,7 @@ replaces the token on a verified synthetic request. It returns
|
|
|
139
139
|
| -- | -- |
|
|
140
140
|
| `ok` | keys present, hostname right, secret accepted by siteverify |
|
|
141
141
|
| `missing_keys` | a key or `TURNSTILE_EXPECTED_HOSTNAME` is unset |
|
|
142
|
-
| `hostname_mismatch` | `TURNSTILE_EXPECTED_HOSTNAME`, normalised, is not the public host (the
|
|
142
|
+
| `hostname_mismatch` | `TURNSTILE_EXPECTED_HOSTNAME`, normalised, is not the public host (the failure that went unnoticed for weeks on a client site) |
|
|
143
143
|
| `test_key_on_production` | a Cloudflare test key on a production host |
|
|
144
144
|
| `invalid-input-secret` | siteverify says the secret is wrong |
|
|
145
145
|
| `siteverify_unexpected` | siteverify answered something else (for example `success` for a dummy token on production) |
|
|
@@ -152,7 +152,7 @@ keys, since staging browser journeys use Cloudflare's always-pass keys.
|
|
|
152
152
|
## Beacons and purge receipts
|
|
153
153
|
|
|
154
154
|
```ts
|
|
155
|
-
const reporter = { key, client: "
|
|
155
|
+
const reporter = { key, client: "example", waitUntil: ctx.waitUntil.bind(ctx) };
|
|
156
156
|
sendBeacon(reporter, { form: "enquiry", code: "accepted" });
|
|
157
157
|
sendPurgeReceipt(reporter, { form: "enquiry", deleted: 24, remaining: 0 });
|
|
158
158
|
```
|
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ type SyntheticMode = "probe" | "full" | "beacon" | "receipt";
|
|
|
20
20
|
declare const MODES: readonly SyntheticMode[];
|
|
21
21
|
declare const FORM_MODES: readonly SyntheticMode[];
|
|
22
22
|
interface SyntheticKey {
|
|
23
|
-
/** Key id, for example `
|
|
23
|
+
/** Key id, for example `example-2026-10`. */
|
|
24
24
|
kid: string;
|
|
25
25
|
/** The 32-byte secret, base64url without padding. */
|
|
26
26
|
secret: string;
|
|
@@ -125,7 +125,7 @@ interface SyntheticContext {
|
|
|
125
125
|
interface VerifyConfig {
|
|
126
126
|
/** Zero, one or two keys. Empty means the synthetic path is off. */
|
|
127
127
|
keys: readonly SyntheticKey[];
|
|
128
|
-
/** The public host the form is served on, for example `www.
|
|
128
|
+
/** The public host the form is served on, for example `www.example.co.uk`. */
|
|
129
129
|
host: string;
|
|
130
130
|
/** The form's path or paths, for example `/api/enquiry`. Exact match, no query. */
|
|
131
131
|
path: string | readonly string[];
|
|
@@ -231,7 +231,7 @@ declare function canaryAddress(kind: "s" | "u", runId: string): string;
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* The Turnstile config self-check that replaces the token on a verified
|
|
234
|
-
* synthetic request. It is the check that would have caught
|
|
234
|
+
* synthetic request. It is the check that would have caught a client site whose
|
|
235
235
|
* forms rejected every submission for about 11 weeks because
|
|
236
236
|
* `TURNSTILE_EXPECTED_HOSTNAME` was wrong.
|
|
237
237
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ type SyntheticMode = "probe" | "full" | "beacon" | "receipt";
|
|
|
20
20
|
declare const MODES: readonly SyntheticMode[];
|
|
21
21
|
declare const FORM_MODES: readonly SyntheticMode[];
|
|
22
22
|
interface SyntheticKey {
|
|
23
|
-
/** Key id, for example `
|
|
23
|
+
/** Key id, for example `example-2026-10`. */
|
|
24
24
|
kid: string;
|
|
25
25
|
/** The 32-byte secret, base64url without padding. */
|
|
26
26
|
secret: string;
|
|
@@ -125,7 +125,7 @@ interface SyntheticContext {
|
|
|
125
125
|
interface VerifyConfig {
|
|
126
126
|
/** Zero, one or two keys. Empty means the synthetic path is off. */
|
|
127
127
|
keys: readonly SyntheticKey[];
|
|
128
|
-
/** The public host the form is served on, for example `www.
|
|
128
|
+
/** The public host the form is served on, for example `www.example.co.uk`. */
|
|
129
129
|
host: string;
|
|
130
130
|
/** The form's path or paths, for example `/api/enquiry`. Exact match, no query. */
|
|
131
131
|
path: string | readonly string[];
|
|
@@ -231,7 +231,7 @@ declare function canaryAddress(kind: "s" | "u", runId: string): string;
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* The Turnstile config self-check that replaces the token on a verified
|
|
234
|
-
* synthetic request. It is the check that would have caught
|
|
234
|
+
* synthetic request. It is the check that would have caught a client site whose
|
|
235
235
|
* forms rejected every submission for about 11 weeks because
|
|
236
236
|
* `TURNSTILE_EXPECTED_HOSTNAME` was wrong.
|
|
237
237
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domandigital/synthetic",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Signed synthetic-submission protocol for Doman Digital client forms: sign and verify, replay guard, recipient lock, Turnstile config self-check, beacons and purge receipts. Web Crypto only.",
|
|
6
6
|
"license": "Apache-2.0",
|