<!-- Source: @site/projects/frontline-api-for-laravel/docs/07-signing-key.md -->
<!-- Canonical: https://docs.pushery.com/frontline-api-for-laravel/signing-key/ -->

# The signing key

> Making the Ed25519 key the sheets are signed with, giving its public half to the gateways, and changing it in four steps without a gateway refusing a sheet.

The sheets are signed with an Ed25519 key only your application knows; the gateways verify them
with its public half. Make the key once:

```bash
php artisan frontline:signing-key 2026-11
```

The command prints `FRONTLINE_API_SIGNING_KEY` and `FRONTLINE_API_SIGNING_KEY_ID` for the
environment of your application, best kept in your secret manager, and `2026-11:<public key>` for
`FRONTLINE_SHEET_KEYS` on every gateway. It keeps the key nowhere else. A secret key whose public
half is not the one its seed gives is refused before anything is signed.

## Changing the key

To change the key, make the next one with `php artisan frontline:signing-key 2027-05 --next` and
follow the steps it prints. The next key takes a label of its own: the gateway reads an envelope
with two signatures under one label as malformed, so the command refuses the label of the current
key, and so does every publication while `FRONTLINE_API_SIGNING_NEXT_KEY_ID` names it.

1. Give every gateway the new public half beside the current one in `FRONTLINE_SHEET_KEYS`,
   separated by a comma.
2. Set `FRONTLINE_API_SIGNING_NEXT_KEY` and `FRONTLINE_API_SIGNING_NEXT_KEY_ID` and run
   `php artisan frontline:publish --force`: every sheet carries a signature by each key.
3. Move the new key into `FRONTLINE_API_SIGNING_KEY` and `FRONTLINE_API_SIGNING_KEY_ID`, remove the
   two `NEXT` settings and run `php artisan frontline:publish --force` again.
4. Remove the old key from `FRONTLINE_SHEET_KEYS` on every gateway.

At every step a gateway that knows the keys of that step takes every sheet.
`php artisan frontline:signing-key --show` prints what `FRONTLINE_SHEET_KEYS` holds for the keys
your application signs with, and never a secret half.
