--- name: private-software-distribution description: Use when setting up private self-updating distribution to a project, with signed updates for closed testers through a Cloudflare Worker and R2. metadata: version: 2026-11-04 --- Ships signed, self-updating builds to closed testers from a Cloudflare Worker, with no public downloads. It suits any updater that can send an auth header and verify a signature. This is a pattern to adapt, so read the updater's own docs for the client side. ## How it works 1. Client sends `GET` feed with `Authorization: Bearer `. 2. Worker looks up `sha256(token)` in KV. Unknown gets 401, over a rate limit gets 429. 3. Registered client gets the feed from R2, then `GET /download/` with the same header. 4. Client verifies the signature against its embedded public key, then installs. Two separate controls: - **Access** comes from the Worker. KV holds only SHA-256 hashes of tokens, so a KV leak yields nothing usable. - **Integrity** comes from the signature. The client accepts only archives signed by the key it shipped with, so a compromised bucket or Worker can't push code to testers. Per project: a Worker, an R2 bucket, a KV namespace, a hostname and an update signing key. Releases run locally, so signing keys stay off CI. ## Setup 1. Ask the user for the project name, a hostname on their Cloudflare zone, and which rate limit namespaces are in use. 2. Copy `assets/` into the project root and rename `package.json.tmpl` to `package.json`. Fill in `wrangler.jsonc`, and add the feed file to `ROUTE` in `src/index.js` if it isn't `latest.json` or `appcast.xml`. 3. Generate the update key with the updater's tool and embed the public half in the client. 4. Provision Cloudflare and deploy. 5. Add the client. 6. Add a single release command, such as `make release`, following the pipeline below. 7. Write a `RELEASING.md` in the project covering releases, recovery, tester tokens and key rules, so operating it needs nothing from this skill. 8. Release, add a token with `scripts/beta-token.sh add