> ## Documentation Index
> Fetch the complete documentation index at: https://docs.entire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install flow

> How a customer installs your plugin, and how to verify the install receipt.

The customer starts on your site, approves on Entire, and returns to you.

1. **You send the customer to Entire.** Make an unguessable state value, tie it to the customer's browser session (for example in a signed, HttpOnly cookie), and redirect to:

   ```text theme={null}
   https://entire.com/plugins/{slug}/install?redirect_uri={post-install URL}&state={state}
   ```

2. **The customer approves.** They sign in to Entire, choose a project they manage, and choose all of its repositories or a list. The page shows the permissions you registered. For `repositories:create` it shows "Create repositories in this project". Only people who manage the project can install plugins.

3. **Entire sends the customer back.** On approval, the browser returns to your `redirect_uri` with two query parameters, `receipt` and `state`. If the customer cancels, it returns with `error=access_denied` and the state instead.

4. **You verify the receipt.** Check every item in the list below before you trust it.

5. **You store the installation ID.** It is the only key you need. Show the customer a confirmation page.

## Verifying an install receipt

The receipt is a compact JWT signed with EdDSA. The SDK's `App.AcceptReceipt` does all of this:

* The `state` query parameter equals the state you stored for this browser session. Compare in constant time. Reject a mismatch as an invalid callback; it can also mean the browser session or stored state was lost.
* The header `typ` is `entire-install-receipt+jwt`, and `alg` is `EdDSA`.
* The `iss` claim is one of Entire's [Cores](https://docs.entire.com/guides/api/regions-and-routing.md#cores). Check this before you fetch keys, because the issuer decides where the keys come from.
* The signature verifies against the key named by `kid` in the issuer's JWKS at `{iss}/.well-known/jwks.json`.
* `aud` includes your registered receipt audience (normally `urn:entire:plugin:{slug}`), configured as `Config.Audience` in the SDK, and `plugin_id` is your slug.
* The receipt passes expiry validation. Receipts last five minutes; the SDK allows one minute of clock leeway. Verify them as soon as they arrive.
* The `state` claim inside the receipt equals your stored state.
* You have not accepted this `jti` before.

The verified receipt carries `installation_id` and `project_id`. It proves issuance at consent time, not continuing access: later API calls still check the installation's live authority.

## Project identity

Store `project_id` when you need to identify the project. For display, use `project_name` and `forge`:

```json theme={null}
{
  "project": "gh:mirrors:<owner id>",
  "project_id": "<project id>",
  "project_name": "acme",
  "forge": "github"
}
```

`project_name` is the native project's name or the mirror owner's account or organization login. `forge` is `entire` or `github`. Names can change, and an Entire project and a mirror can have the same name, so keep the name and forge together and use the ID as your key.

The receipt's older `project` string stays unchanged for compatibility. For a mirror it can be an internal name such as `gh:mirrors:...`. Don't use it for display.

[Installation webhooks](https://docs.entire.com/guides/api/plugins/webhooks.md#installation-events) put the same information in a `project` object. On a webhook it is under `event.payload.installation`:

```json theme={null}
{
  "project_id": "<project id>",
  "project": {"id": "<project id>", "name": "acme", "forge": "github"}
}
```

Use `project.id` as the identifier and `project.name` with `project.forge` for display. The existing `project_id` stays and equals `project.id`.

The display fields are optional. Older receipts and events lack them, and Entire omits them when it cannot look up the public project name. Keep processing the installation using its IDs; missing display metadata doesn't revoke access.

The receipt and installation events also include `manage_url` when available. Link to it from your settings so the customer can manage the installation. Store it before uninstall: `installation.deleted` doesn't include it. Don't parse it to find the project's name or forge.

## Key installations on their ID alone

Installations are global. Any Core serves any installation, and the receipt's issuer only tells you which Core handled the consent. Do not key your records on the issuer, and do not assume the installation belongs to one region. Call the nearest trusted Core and sign your plugin JWT for that Core's authentication audience. Mint an installation token on the Core where you will use it for Core operations; do not assume every Core accepts a token issued elsewhere.
