@@ -165,6 +165,30 @@ Set `TOLGEE_APP_CLIENT_ID` and `TOLGEE_APP_CLIENT_SECRET` only when you deploy
165165the app somewhere that injects secrets properly — the environment wins over the
166166local file, and setting either one makes the SDK ignore the file entirely.
167167
168+ # # Credentials Tolgee pushes at you
169+
170+ Registration is not the only way this app gets credentials. Tolgee POSTs **signed
171+ lifecycle deliveries** to the `baseUrl` in the manifest, and `server/index.ts`
172+ receives them in a single `mountTolgeeLifecycle(app, …)` call.
173+
174+ There are two credential layers, and the deliveries carry both : **app-level**
175+ (`tgpub_` / `tgpubs_`, at registration) identifies and administers the app
176+ everywhere it is installed and reaches no data; **per-install** (`tgapp_` /
177+ ` tgapps_` , at install) is what the worker actually polls Tolgee with. A rotation
178+ of either arrives the same way — and this app drops its cached access token when
179+ one does, so the next poll authenticates with the new secret.
180+
181+ A third secret, the **webhook secret**, arrives with the registration and is
182+ never sent anywhere : Tolgee signs each delivery
183+ ` HMAC-SHA256(webhookSecret, "<timestamp>.<body>")` in a `Tolgee-Signature`
184+ header, so holding it is what proves a delivery is really Tolgee. The SDK
185+ verifies every one, refuses a stale or replayed timestamp (5-minute window), and
186+ **refuses a first delivery once this app already holds credentials for that
187+ instance**, so nobody can push their own credentials over yours.
188+
189+ Note what this channel does *not* replace : per-project enablement is still
190+ polled, which is what `fetchAppInstallations()` is for.
191+
168192# # Enabling the app for a project
169193
170194**Project → Settings → Apps → Activity Worker → enable**
@@ -196,7 +220,7 @@ src/ iframe page (Vite + React)
196220 useActivityFeed.ts polls the app's own /api/feed
197221 feedTypes.ts the feed contract, shared with the server
198222server/
199- index.ts manifest + /api/feed + self-registration + worker start
223+ index.ts manifest + /api/feed + self-registration + lifecycle + worker start
200224 activityWorker.ts the two polling loops (installations, activity)
201225 translationChanges.ts pulls translation edits out of an activity revision
202226 tolgeeAccess.ts install-context token, cached until it nears expiry
@@ -208,7 +232,7 @@ scripts/
208232 dev-tunnel.ts opens the tunnel and publishes its URL
209233.tolgee-dev/ local state, gitignored
210234 tunnel.json the URLs Tolgee currently reaches this app at
211- install.json install id + app credentials, written at registration
235+ install.json app-level + per-install credentials, written as they arrive
212236```
213237
214238## Limits worth knowing
0 commit comments