Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
26ac562
Worker tests: share the D1 and R2 fakes
teaspoonai Nov 29, 2026
bbde3ac
Worker: issue and renew engine license keys (#474)
teaspoonai Nov 29, 2026
a909f61
Docs: the license signing key, and what key issuance records (#474)
teaspoonai Nov 29, 2026
096e7f9
Docs: prod.pub's line for the online key, exactly (#474)
teaspoonai Nov 29, 2026
ef720e2
Worker: license revocations stick; the cap is atomic and indexed (#474)
teaspoonai Nov 29, 2026
f706440
Docs: license revocation and release, and rows that outlive their acc…
teaspoonai Nov 29, 2026
af339a4
Worker: a revoked key holds for its device, and keeps counting (#474)
teaspoonai Nov 29, 2026
a194be9
Docs: revoking a key holds for the device; revoked keys count (#474)
teaspoonai Nov 29, 2026
62f3f38
Worker: a revoked key of any tier bars its device (#474)
teaspoonai Nov 29, 2026
d83753d
Worker: the revoked-device bar covers appliance keys too (#474)
teaspoonai Nov 29, 2026
813fe05
Worker: renewals need the current license; a re-provisioned box keeps…
teaspoonai Nov 29, 2026
a301962
Docs: renewal after a license change, and a re-provisioned box's key …
teaspoonai Nov 29, 2026
1f1d083
Worker: an appliance key moves only to a record of the same box (#474)
teaspoonai Nov 29, 2026
08aa2ef
Docs: what a leaked FACTORY_TOKEN does to license keys, and the clean…
teaspoonai Nov 29, 2026
03d1938
Docs: the leak runbook revokes the suspect records first, and sorts k…
teaspoonai Nov 29, 2026
d1063ee
Worker tests: run the leak runbook as RELEASING.md writes it (#474)
teaspoonai Nov 29, 2026
ec68c88
Worker: record each appliance key's first maker acceptance (#474)
teaspoonai Nov 29, 2026
2d8ec56
Docs, tests: the leak runbook sorts by first_maker_id and checks LEAK…
teaspoonai Nov 29, 2026
5725a1d
Worker: a maker acceptance that ever held a key gets no other (#474)
teaspoonai Nov 29, 2026
1d2fcaa
Docs: license_makers, and a spent maker acceptance (#474)
teaspoonai Nov 29, 2026
280c1d5
Docs: the licenses page's Worker citation, moved by the license route…
teaspoonai Nov 29, 2026
f7c7a41
Docs: an erasure request keeps the license key records, restricted to…
teaspoonai Nov 29, 2026
878994b
Merge remote-tracking branch 'origin/main' into feat/license-issue-474
teaspoonai Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 160 additions & 16 deletions docs/engine-license-data.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/licenses.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The installer records your acceptance with Teaspoon AI, together with the licens

To accept without the prompt, name the version you read: `--accept-eula=<version>`, with the version the license's title names, and give `--email`, plus `--license-id` for licensed use. A bare `--accept-eula`, or another version, stops the installer.

<!-- source: THIRD_PARTY_LICENSES.md:3-5#1e314cfb; install.sh:134,163-173,433-465,539-654#6e62d947; worker/src/index.js:258-264,310-315#290d30f9; install.sh:506-517#bffd8d4a -->
<!-- source: THIRD_PARTY_LICENSES.md:3-5#1e314cfb; install.sh:134,163-173,433-465,539-654#6e62d947; worker/src/index.js:280-286,332-337#290d30f9; install.sh:506-517#bffd8d4a -->

## The LGPL libraries

Expand Down
197 changes: 192 additions & 5 deletions packaging/RELEASING.md

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions worker/migrations/0004_licenses.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
-- teaport download gate: the engine license keys it signs (teaport#474).
-- Applied by .github/workflows/worker-deploy.yml before each deploy, never by hand from a branch.
-- Additive only: a new table and new indexes, so the Worker before it still runs against
-- this schema (a rollback), and nothing here needs one.
-- What each column holds, and how long it is kept: docs/engine-license-data.md.

-- One row per license key (POST /api/license): its terms, the device it is bound to and
-- the record it was issued under. A renewal re-signs the same row (same license_id), so
-- revoking one id stops it for good, however often it was renewed. A device holds at most
-- one personal key per email address that is not released (the Worker's insert checks it).
-- Revoking a key, of any tier, is the device's: it gets no new key and no renewal of any
-- tier, under any email address, until the row is released. Revoking an acceptance (acceptances.revoked_at) revokes the personal
-- keys last issued under it for that person. Revoked keys count toward the person's cap
-- until they expire. No email and no name:
-- the key file holds none, and this row reaches the person only through acceptance_id.
-- No foreign keys: D1 enforces them, and the retention cron (the Worker before this one
-- included) must go on deleting acceptances and maker acceptances a license names.
CREATE TABLE licenses (
license_id TEXT PRIMARY KEY, -- "TPL-" + 20 random Crockford base32 characters
tier TEXT NOT NULL CHECK (tier IN ('personal', 'appliance', 'commercial')), -- commercial: recorded by hand, signed offline
device TEXT NOT NULL, -- tpdev2-<32 hex>, from `voxtral --device-id`
kid TEXT NOT NULL, -- the label of the key that signed it last
engine_major INTEGER NOT NULL,
issued_at INTEGER NOT NULL, -- Unix seconds, as signed
expires_at INTEGER, -- Unix seconds, as signed; personal only
acceptance_id TEXT, -- personal: the acceptance it was last issued under; appliance: its owner's, once linked (teaport#465)
maker_id TEXT, -- appliance: the maker acceptance that holds it now (one key each)
first_maker_id TEXT, -- appliance: the maker acceptance it was first issued under; a move (a box
-- provisioned again) never changes it: what a leak's cleanup sorts keys by
created_at TEXT NOT NULL, -- ISO 8601, UTC: first issued
signed_at TEXT NOT NULL, -- ISO 8601, UTC: last signed (an issue, a repeat or a renewal)
revoked_at TEXT, -- set by hand: no renewal, and (W2) on the revocation list; it sticks:
-- the device (whatever this key's tier) gets no new key and no renewal
-- of any tier, and a personal key counts toward its person's cap until
-- it expires
revoke_reason TEXT,
released_at TEXT -- set by hand: a personal key's slot freed (the owner asked, by email),
-- or any revoked key's bar on its device lifted;
-- it no longer counts or renews, and the device may get a new key
-- (on a revoked row too: that lifts the revocation for the device)
);
-- One appliance key per maker acceptance, held by the database itself: two requests at once
-- cannot both write one.
CREATE UNIQUE INDEX licenses_maker ON licenses (maker_id) WHERE maker_id IS NOT NULL;
CREATE INDEX licenses_acceptance ON licenses (acceptance_id); -- the 3-device cap, access and erasure
CREATE INDEX licenses_device ON licenses (device);
CREATE INDEX licenses_expires ON licenses (tier, expires_at); -- the retention cron

-- Every maker acceptance that ever held an appliance key, and the key: issued under it, or
-- moved to it (a box provisioned again). Insert-only, written by the triggers below in the
-- same statement as the key's write, so no request can slip between the two. A record here
-- never issues or receives another key (the Worker checks it): a box provisioned again
-- leaves its old record holding nothing, and that record's id is still in the box's old
-- receipt, so without this anyone who can read it could mint a second, perpetual key for
-- other hardware. Kept for good: only ids, and the maker acceptance may be deleted by
-- retention while the key it held is still in use.
CREATE TABLE license_makers (
maker_id TEXT PRIMARY KEY, -- a maker acceptance's id
license_id TEXT NOT NULL, -- the key it held first
at TEXT NOT NULL -- ISO 8601, UTC: when it got it
);
CREATE TRIGGER licenses_maker_insert AFTER INSERT ON licenses WHEN NEW.maker_id IS NOT NULL
BEGIN
INSERT OR IGNORE INTO license_makers (maker_id, license_id, at)
VALUES (NEW.maker_id, NEW.license_id, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
END;
CREATE TRIGGER licenses_maker_update AFTER UPDATE OF maker_id ON licenses
WHEN NEW.maker_id IS NOT NULL AND NEW.maker_id IS NOT OLD.maker_id
BEGIN
INSERT OR IGNORE INTO license_makers (maker_id, license_id, at)
VALUES (NEW.maker_id, NEW.license_id, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'));
END;

-- The 3-device cap counts a person's devices by their acceptances' email, lowercased and
-- trimmed, as SQLite's lower() and trim() do it (ASCII letters only): the Worker compares
-- it in SQL, so the address never reaches the Worker's code on this path.
CREATE INDEX acceptances_email_norm ON acceptances (lower(trim(email)));
Loading
Loading