# ship a plugin on rooot

two jobs, written for your coding agent: export the release zips rooot takes, and add rooot licensing so your pro features open for people who own the plugin. paste this page into claude or codex.

## 1. export the release zips

you upload one build per platform: a mac zip and a windows zip. rooot reads the paths inside each zip and pre-ticks the formats and the platform for you.

| what | rule |
| --- | --- |
| file types | `.zip` (plugin bundles inside), or an installer: `.dmg` `.pkg` `.exe` `.msi` |
| formats inside a zip | `Name.vst3`, `Name.component` (au, mac only), `Name.clap` |
| size | 2 GB per file, 6 files per plugin |
| not accepted | password zips, symlinks, paths that climb out of the zip (`../`) |
| review | every file is scanned for viruses, then approved by rooot before anyone can download it |

the bundles go at the top of the zip (a wrapper folder around them works too), with their folder structure intact. `Name.vst3` is a folder, not a single file, on mac and on windows.

mac. build both architectures, then zip the bundles:

```bash
# JUCE + CMake: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" at configure time
cmake --build build --config Release

# bundles live in build/<Target>_artefacts/Release/{VST3,AU,CLAP}/
mkdir -p dist/mac
cp -R "build/Name_artefacts/Release/VST3/Name.vst3" "build/Name_artefacts/Release/AU/Name.component" dist/mac/
# add "build/Name_artefacts/Release/CLAP/Name.clap" the same way if you ship clap

# sign the copies in dist/mac BEFORE zipping (see below)
codesign --force --deep --options runtime --timestamp --sign "Developer ID Application: …" dist/mac/Name.vst3 dist/mac/Name.component

(cd dist/mac && zip -r -X ../Name-1.0-mac.zip Name.vst3 Name.component)
```

signing comes before the zip, so the zip holds signed bundles. notarize them too if you can. rooot does not require either, but macos warns buyers about unsigned plugins. add `Name.clap` to the `zip` line if you ship clap.

windows. build in Release, then zip with the `tar` that ships with windows 10 and 11:

```powershell
cmake --build build --config Release
# bundles live in build\Name_artefacts\Release\{VST3,CLAP}\
New-Item -ItemType Directory -Force dist\win | Out-Null
Copy-Item -Recurse build\Name_artefacts\Release\VST3\Name.vst3 dist\win\
tar -a -c -f dist\Name-1.0-win.zip -C dist\win Name.vst3
```

use `tar -a -c -f`, not `Compress-Archive`: older powershell writes backslash paths into the zip.

check the zip before you upload it:

```bash
unzip -l dist/Name-1.0-mac.zip | head -20
```

a good mac zip (`dist/Name-1.0-mac.zip`) lists `Name.vst3/Contents/MacOS/Name` and `Name.vst3/Contents/Info.plist`. a good windows zip lists `Name.vst3/Contents/x86_64-win/Name.vst3`. if you see source files or a `.app` and nothing else, you zipped the wrong thing.

then open your plugin in the studio and drop each zip on its builds. the studio sets formats and platform from the files; change them if it guessed wrong.

## 2. add rooot licensing to a JUCE plugin

the plugin stays a free download. your pro features open once the person owns the plugin on rooot. rooot signs a license for their machine; the plugin checks it offline, forever, with no server of yours.

you need two values from your plugin in the studio: its `slug` and its `id`. the copy-prompt button in the studio fills both into a ready brief. below they are `<slug>` and `<kit id>`. your agent needs both as inputs: the `<slug>` goes into the device id and the `<kit id>` is what the license is checked against.

- rooot signs every license with one key and puts your plugin's `<kit id>` in it. the same public key checks every plugin; you run no licensing service.
- you own your own plugin, so you can try it yourself: connect while signed in as the seller account.
- a license is perpetual and tied to one machine. a person opens another machine by connecting again from it.
- it is an offline check, a speed bump, not copy protection. do not promise more than that on your page.

step 1: compile in the public key, once, now. never fetch it at run time.

```bash
curl -s https://rooot.online/api/plugin/license-key
```

the answer is `{ "alg": "ES256", "kid": "…", "x963_hex": "04…", "spki_pem": "-----BEGIN PUBLIC KEY-----…" }`. it is a P-256 key. put `x963_hex` (65 bytes, starts with `04`) or `spki_pem` in the source. fetching at run time would let someone on the network swap the key.

step 2: a "connect rooot" button asks rooot for a code.

```http
POST https://rooot.online/api/plugin/connect/start
Content-Type: application/json
X-Rooot-Plugin: v=<plugin version>; daw=<host name>; os=<mac|windows>

{"purpose":"license","plugin":"<slug>"}
```

the answer is `{ "code", "poll_token", "connect_path", "expires_in": 600, "interval": 3 }`. open `https://rooot.online` + `connect_path` in the default browser and show `code` in the plugin. the person signs in, taps connect, and buys the plugin there if they do not own it yet. if start answers `429` (`rate_limited` or `too_many_open`, with `retry_after_seconds`), wait that long and show it in the plugin; `400` means the slug is wrong; `500` means try again later.

step 3: poll until the license arrives.

```http
POST https://rooot.online/api/plugin/connect/license
Content-Type: application/json

{"poll_token":"<poll_token>","device":"<device id>"}
```

`device` is 64 lowercase hex characters: `sha256("rooot-license:<slug>:" + a stable machine id)`. use the machine id string exactly as the system gives it, with no changes, and the same one every time on the same machine (mac: the `IOPlatformUUID` from IOKit, or `ioreg -rd1 -c IOPlatformExpertDevice`; windows: the `MachineGuid` value under `HKLM\SOFTWARE\Microsoft\Cryptography`, opened with `KEY_WOW64_64KEY` so a 32-bit build reads the same value). hex is lowercase. to check your hash: `sha256("rooot-license:demo:machine-1")` is `076ddf60a680fa2438a56821e2d7b202e38e986cfc3052bfdecc96af53c997e8`. call this every `interval` seconds, from a background thread.

| answer | what the plugin does |
| --- | --- |
| `200 { "status": "pending" }` | not approved yet: keep polling |
| `200 { "status": "not_owned", "buy_path": … }` | approved but not bought: keep polling, a purchase before the code expires (10 minutes after start) opens it on the next poll |
| `200 { "status": "licensed", "license": … }` | verify the license, save it, open pro |
| `410` | expired, used or unknown: stop and offer to start again |
| `404 { "status": "unknown_plugin" }` | the slug is wrong: stop |
| `429 { "retry_after_seconds": n }` | too fast: wait n seconds, keep polling |
| `503 { "error": "license_unavailable" }` | rooot cannot sign right now: try later, nothing was used up |

step 4: verify the license before you trust it. it looks like this:

```text
rl1.<base64url payload JSON>.<base64url signature>
payload   = { "kid", "plugin", "slug", "sub", "device", "iat" }
signature = ECDSA P-256 over SHA-256, DER encoded, of the text "rl1.<base64url payload JSON>"
```

split it on `.` into exactly three parts, the first being `rl1`; the base64url parts have no `=` padding. trim spaces and newlines when you read a saved license back from disk. parse the payload with `juce::JSON`, not string searching. accept it only when all three hold: the signature verifies with the compiled-in key; `payload.plugin` equals your `<kit id>`; `payload.device` equals this machine's device id. then save the whole string on disk (for example `~/Library/Application Support/<name>/license.txt` on mac, `%APPDATA%\<name>\license.txt` on windows) and run the same three checks at start-up. no network call after that.

step 5: use the operating system's crypto. juce has no ECDSA verify, and you do not need a library.

- mac: Security.framework. `SecKeyCreateWithData` with `kSecAttrKeyTypeECSECPrimeRandom` and `kSecAttrKeyClassPublic` takes the 65-byte `x963_hex` key as is. `SecKeyVerifySignature` with `kSecKeyAlgorithmECDSASignatureMessageX962SHA256` takes the DER signature as is, and hashes the message for you.
- windows: CNG (bcrypt). open `BCRYPT_ECDSA_P256_ALGORITHM`, import the key as a `BCRYPT_ECCPUBLIC_BLOB` (header with `BCRYPT_ECDSA_PUBLIC_P256_MAGIC` and 32, then X and Y: the 64 bytes after the `04` of `x963_hex`). `BCryptVerifySignature` wants a raw 64-byte r||s signature and a SHA-256 hash you compute yourself, so convert the DER signature to r||s first: two 32-byte integers, left-padded with zeros, leading zero bytes of the DER integers dropped.
- the signature in the license is DER on both: only windows needs the conversion. read the DER length bytes properly (a length over 127 uses the long form) and treat anything malformed as a rejected license.

juce covers the rest: `juce::URL` and `juce::WebInputStream` for the two posts, `juce::JSON` for the answers, `juce::URL::launchInDefaultBrowser()` for the connect page, a `juce::Thread` for the polling, `juce::MessageManager::callAsync` to update the button. check the license once at start-up and after a connect, keep the result in a bool, and read that bool from the audio thread. never verify or touch the network in `processBlock`.

to check your own verifier, this node script prints the payload of a license it accepts and nothing for one it does not:

```js
import { createPublicKey, verify } from 'node:crypto'
const k = await (await fetch('https://rooot.online/api/plugin/license-key')).json()
const [pre, body, sig] = process.argv[2].split('.')
const ok = verify('sha256', Buffer.from(pre + '.' + body), { key: createPublicKey(k.spki_pem), dsaEncoding: 'der' }, Buffer.from(sig, 'base64url'))
if (ok) console.log(Buffer.from(body, 'base64url').toString())
```

when it works: tap the connect button in a build, connect in the browser as the seller account, the plugin shows pro, and it still shows pro after you quit and reopen with the network off.
