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

# Image and keys

> Pull the TablePro server image from GHCR, verify its cosign signature, SBOM and provenance, mirror it to a private registry, and generate the server's keys

Pull from `ghcr.io/tableproapp/tablepro-cloud`. It is public, built for `linux/amd64` and `linux/arm64`, and the current release is `0.1.0`.

| | |
| - | - |
| Tags | `X.Y.Z` and `X.Y`, such as `0.1.0` and `0.1`. There is no `latest` |
| Base | `gcr.io/distroless/static-debian13:nonroot`. No shell |
| User | 65532. The root filesystem can be read-only |
| Entry point | `/tablepro-cloud`, default command `serve`, listening on `:8080` |
| `version` | Prints the release, such as `0.1.0` |
| Third-party notices | `/usr/share/doc/tablepro-cloud/THIRD_PARTY_NOTICES` |
| Amazon RDS CA bundle | `/etc/ssl/rds-global-bundle.pem`, for `sslrootcert` in `DATABASE_URL` |

Deploy by digest, not by tag. Get the index digest with:

```bash theme={null}
docker buildx imagetools inspect ghcr.io/tableproapp/tablepro-cloud:0.1.0
```

`Digest:` at the top is the index digest. Each entry under `Manifests:` names one platform's digest.

## Verify the image

Every release is signed with an ECDSA P-256 key held in AWS KMS, and each platform carries an SPDX SBOM and SLSA v1 provenance attested with the same key. Save the public key as `cosign.pub`:

```text cosign.pub theme={null}
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEBqAzLv/I4f35AlVR8JI4EGY8JyDF
3N5hdKCrsaHsw8J5A3CnA1tu4AOwwyrbY2Rwzt0VVVASebaHHzsieRMXWQ==
-----END PUBLIC KEY-----
```

Check your copy against the SHA-256 of its DER SubjectPublicKeyInfo, `98af193b4a4f3867cd4c66b09406196ba3ec189f80e5cbcc7d56085e5c4ddbde`:

```bash theme={null}
openssl pkey -pubin -in cosign.pub -outform DER | sha256sum
```

Then, with cosign 3:

```bash theme={null}
cosign verify --key cosign.pub ghcr.io/tableproapp/tablepro-cloud@sha256:<index digest>

# The SBOM and the provenance are on each platform's manifest.
cosign verify-attestation --key cosign.pub --type spdxjson ghcr.io/tableproapp/tablepro-cloud@sha256:<platform digest>
cosign verify-attestation --key cosign.pub --type slsaprovenance1 ghcr.io/tableproapp/tablepro-cloud@sha256:<platform digest>
```

The signatures are also in Sigstore's public Rekor log, which `cosign verify` checks by default.

### Mirror to a private registry

```bash theme={null}
oras cp -r ghcr.io/tableproapp/tablepro-cloud@sha256:<index digest> registry.example.com/tablepro-cloud:0.1.0
```

ORAS 1.3 or later copies the signatures and attestations with the image, since cosign 3 stores them as OCI referrers. `cosign copy` 3.1 leaves them behind. Run the verify commands against the mirror afterwards.

For an air-gapped network, verify on a connected machine, then mirror. Inside, add `--insecure-ignore-tlog=true` to the cosign commands to check the signature against the key alone.

## Generate the keys

The server needs three keys, passed as one JSON value in `TABLEPRO_CREDENTIALS`:

| Credential | What it is |
| - | - |
| `oauth-access` | Ed25519 key that signs the apps' access tokens |
| `entitlement` | Ed25519 key that signs each Mac's plan |
| `identity-tokens.1` | 32 random bytes that encrypt the IdP refresh tokens the server keeps |
| `saml-idp-metadata` | With a SAML IdP only: the IdP's metadata file |
| `saml-idp-certificates` | Optional, SAML only: extra IdP signing certificates in PEM, for a [certificate rotation](https://docs.tablepro.app/self-hosted/sign-in.md#rotate-the-idps-signing-certificate) |

Save this script as `credentials.sh`. It runs the image's own `keys generate`, with no network, and prints the JSON:

```sh credentials.sh theme={null}
#!/bin/sh
# Prints a new TABLEPRO_CREDENTIALS value: the JSON object of the keys a self-hosted install needs.
# Usage: credentials.sh <image> [<SAML IdP metadata file>]. Each run makes new keys; run it once per install and keep
# the output. With a SAML IdP, the metadata file becomes saml-idp-metadata.
set -eu

image=${1:?usage: credentials.sh <image> [<SAML IdP metadata file>]}
metadata=${2:-}
dir=$(mktemp -d)
trap 'rm -rf "$dir"' EXIT

for name in oauth-access entitlement; do
	docker run --rm --network none --user "$(id -u):$(id -g)" -v "$dir:/keys" "$image" \
		keys generate --name "$name" --dir /keys >/dev/null
done
(umask 077 && head -c 32 /dev/urandom | base64 >"$dir/identity-tokens.1")
names="oauth-access entitlement identity-tokens.1"
if [ -n "$metadata" ]; then
	cp "$metadata" "$dir/saml-idp-metadata"
	names="$names saml-idp-metadata"
fi

# Each file as a JSON string: backslashes, quotes, tabs and line breaks escaped, carriage returns dropped.
printf '{'
sep=
for name in $names; do
	printf '%s"%s":"%s"' "$sep" "$name" "$(awk '{ gsub(/\r/, ""); gsub(/\\/, "\\\\"); gsub(/"/, "\\\""); gsub(/\t/, "\\t"); printf "%s\\n", $0 }' "$dir/$name")"
	sep=,
done
printf '}\n'
```

Run it once per install, with the image by digest, and with your SAML IdP's metadata file when you use SAML:

```bash theme={null}
chmod +x credentials.sh

# OIDC
./credentials.sh ghcr.io/tableproapp/tablepro-cloud:0.1.0@sha256:<index digest> > credentials.json

# SAML 2.0: the IdP's metadata file as the second argument
./credentials.sh ghcr.io/tableproapp/tablepro-cloud:0.1.0@sha256:<index digest> idp-metadata.xml > credentials.json
```

> [!WARNING]
>
> Keep a copy of the output offline and encrypted, next to the database backups. A database restored without the same `identity-tokens.1` cannot read the IdP refresh tokens it holds, and a new `entitlement` key makes every Mac fetch the keys again. Each run makes new keys.

To rotate the access token key, move the current key to `oauth-access-previous`, put a new one from the image's `keys generate` under `oauth-access`, and restart. Access tokens live 15 minutes: after that, remove `oauth-access-previous` and restart again. To rotate the refresh token key, add `identity-tokens.2`, from `openssl rand -base64 32`, beside `identity-tokens.1` and restart. New values use the highest number, and the older keys still decrypt.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.