cloudflare/matched-data-worker
TypeScript
Captured source
source ↗cloudflare/matched-data-worker
Language: TypeScript
License: MIT
Stars: 7
Forks: 7
Open issues: 2
Created: 2024-06-04T13:37:10Z
Pushed: 2026-04-28T09:51:18Z
Default branch: main
Fork: no
Archived: no
README:
Matched Data JS
Logpush Setup
1. Dataset:
- Firewall Events
2. Select Data Fields:
- Required: General > Metadata
- Any others are optional
3. Select Destination:
- S3 Compatible
4. Enter Destination Info (see example below):
- Given the final URL you want to use is
./logs: and` are arbitrarylogsis required according to the default configuration of the worker- _S3 Compatible Bucket Path_:
/logs - _Endpoint URL_: ``
- All other fields can be arbitrary values
Logpush Setup Example

Configure and Deploy
1. Edit wrangler.toml to add DOMAIN, SUBDOMAIN, and ACCOUNTID. 2. Edit src/index.ts to send the decoded data anywhere you would like. 3. Run npx wrangler secret put MATCHED_PAYLOAD_PRIVATE_KEY:
- Enter the private key generated when deploying a matched payload.
- Refer to the documentation for more information on generating the private/public key pair.
- If you want to use GCS, you also need
GCS_BUCKET_NAMEandGCS_ACCESS_KEY_JSON.
4. Run npm run deploy.
Destinations
Currently supported destinations:
- Google Cloud Storage
An example src/destinations/counter.ts is given if you want to implement any others.
Matched Payload Format
The matched data payload is base64 encoded, and then binary encoded using the following format:
[version: 1 byte][encapped key: 32 bytes][payload size: 8 bytes][payload: N bytes]
Local testing
1. Run echo 'MATCHED_PAYLOAD_PRIVATE_KEY=uBS5eBttHrqkdY41kbZPdvYnNz8Vj0TvKIUpjB1y/GA=' > .dev.vars (taken from https://github.com/cloudflare/matched-data-cli). 2. In terminal window 1, run: npm run dev. 3. In terminal window 2, run: npm run req. 4. Back in terminal window 1, you should see 'test matched data'.
See Also
https://github.com/cloudflare/matched-data-cli