feat: optional Ever Platform connection (off by default)
What
Optional Ever Platform connection, off by default. With TR_EVER_CONNECT_ENABLED=true the operator of the installation can connect it to an organization on Ever Platform with a connect code from app.ever.co. Without the switch the module is not imported (no route, no timer, no client); with it, nothing is called before the operator connects.
- Connect (
POST /api/v1/ever-connect/connect): a new Ed25519 connection key, its private half stored AES-256-GCM encrypted under HKDF(TR_SECRET) with its own purpose (never the statistics key), and one redeem carrying the product, its version, the declared install source, the public key and the name the operator typed: no address, no user or project data. The whole installation is linked to the organization (one link,product_tenant_id: '*', which Ever Platform can re-key later).TR_EVER_CONNECT_CODEredeems a code once at start and never retries it. Refused withoutTR_SECRET(409 secret_missing), with a malformed code (400, nothing sent) or when already connected (409). - While connected: a heartbeat (within 5 minutes, then daily, with the deny list of
TR_EVER_CONNECT_INTEGRATIONS_DENY), the installation's and the link's entitlement documents every 6 hours, verified by the SDK before they are stored (the page shows the plan and its valid / stale / paused state; no project, term, translation, import or export path reads them), and the event feed (long poll, or every 15 minutes withTR_EVER_CONNECT_FEED_MODE=interval) that re-reads consent, plan and link states. A lease on the connection row lets one API process make these calls. A revoked credential or a revoke event stops every call. - Integrations (
instance_url,stats_link;ever_id_loginshown as coming soon): states come only from consents recorded in app.ever.co; Enable opens the app.ever.co consent link, an installation-wide one then waits for the operator's Accept. Switch off tells Ever Platform first, and when it cannot be reached the integration is off here at once and the revoke is resent with the next heartbeat. The installation address is sent only after theinstance_urlconsent (409 consent_requiredbefore).stats_linksends a statement signed by the statistics key, only when the statistics are on. Each integration lists what it moves (Show scope, the same table app.ever.co shows). - Disconnect: Ever Platform is told first; the key, documents and integration states are deleted here even if it cannot be reached. The anonymous usage statistics are not touched.
- Audit: every change is recorded with a user id (never an e-mail), and each row carries the SHA-256 of the previous one.
GET /api/v1/ever-platform/status(operator only, present with either module) tells the web app which sections to show; the Ever Platform page now has a Connection section next to Statistics.- All Ever Platform calls go through
@ever-co/connect-sdk(public, Apache-2.0,1.0.0-rc.8): one origin, no redirect, signed client assertion, document verifiers. The module's own adapter (ever-connect-platform.client.ts) is the only file that builds the client. - Tables (one migration, sqlite / postgres / mysql):
ever_connect_connection,ever_connect_integration,ever_connect_audit.
Tests
- Unit (in-memory sqlite, a fake platform): nothing called before connect; one redeem with exactly the documented fields and the key stored encrypted; malformed code, missing
TR_SECRETand a second connect send nothing; a refused code stores nothing; heartbeat with the deny list, feed page acknowledged and its consent event applied; public address only after consent; offline switch-off resent at the next heartbeat; operator accept; revoked credential stops all calls; disconnect forgets the key and calls nothing more;TR_EVER_CONNECT_CODEtried once; audit chain. Settings parsing, module wiring for every switch combination, the route manifest, and static checks (the SDK client is built in one file only). - e2e (sqlite): operator-only routes (401 signed out, 404 for other users and API clients), the menu status, connect / status (no key in any answer) / integrations / consent link /
consent_required/ disconnect / audit; with the switch unset, no route and no row. - The SDK adapter was also run against the SDK's mock platform (
ever-mock-platformfrom@ever-co/connect-tools): redeem, instance token, heartbeat, installation and link entitlement documents (verified, then 304), integrations, consent link, event feed, disconnect, andcredential_revokedafter it.
Not in this change
Per-organization links (Traduora has no organizations yet; the single link can be re-keyed later), person deletion/export requests and person links, the provisioning hand-off, and managed operations.
🤖 Generated with Claude Code
Summary by cubic
Adds an optional Ever Platform connection, off by default. With TR_EVER_CONNECT_ENABLED=true the operator can connect the installation to an organization on Ever Platform with a code from app.ever.co; with the switch unset, the module is not imported at all. Even when enabled, nothing is sent until the operator connects.
Connection and background calls
- Connecting redeems the code once under a row lease so only one process connects at a time; a random claim token means only the attempt that claimed the row completes or releases it, and a refused code releases the claim for another attempt. A new Ed25519 connection key is created (its private half stored AES-256-GCM encrypted under
TR_SECRET), and the whole installation is linked to one organization. - Connecting is refused without
TR_SECRET, with a malformed code, or when already connected; a connection waiting for approval reads its own state every minute and starts once approved. - While connected: a daily heartbeat with the deny list, verified entitlement documents every 6 hours, and the event feed (long poll, or every 15 minutes with
TR_EVER_CONNECT_FEED_MODE=interval). - Background writes apply only to the connection that started them and never move the feed position back; a feed page is acknowledged only after every update it carried landed, entitlement documents are written only when the link actually changed, and the deny list and Statistics switch are enforced at send time, with a failed statistics link retried.
- Disconnect tells Ever Platform first, then ends the connection and its integration states in one transaction even if the platform cannot be reached; a revoked credential or revoke event stops all calls.
- Every change is recorded in a hash-chained audit trail with the acting user id, never an e-mail; only the last 500 rows are kept.
Integrations and web app
- Integration states (
instance_url,stats_link;ever_id_logincoming soon) come only from consents recorded in app.ever.co; enabling one opens the consent link, an installation-wide integration waits for the operator's accept, and a consent link of an earlier connection is dropped. - The installation address is sent only after the
instance_urlconsent;stats_linksends a statement signed by the statistics key. An integration switched off while the platform is unreachable stays off here until the revoke is delivered. - Operator-only routes and a new connection section on the Ever Platform page drive the flow; the page shows load errors with a retry, ignores answers from before a change, and re-reads the status after every change.
- Adds three tables (one migration) and the public
@ever-co/connect-sdk(Apache-2.0,1.0.0-rc.8); all platform calls go through one adapter file.