Skip to content
Verify signed responses

Verify signed responses

This guide adds signature checks to your application. At the end, your application trusts an answer from the License API or the Distribution API only when its signature is valid.

Before you start

  • Your application calls the License API or the Distribution API. See Add your application.
  • You have a signing key. Copy its key ID and its public key in Base64 from the dashboard.

The examples call https://license.seatify.dev. The Distribution API signs its answers in the same way and with the same key. In curl, the keys are the variables $SEATIFY_PUBLISHABLE_KEY and $SEATIFY_SIGNING_KEY_ID. In the other languages, they are variables of your application.

Steps

Embed the public key

Put the key ID and the public key in your application as constants. Never download the key at run time. A person who can change an answer can also change a downloaded key.

You can embed more than one key. Each signature names the key ID of the key that made it. See Rotate signing keys.

Send a nonce and the key ID

Send two more headers with each request:

HeaderValue
Seatify-NonceA new random value, such as a UUID. Seatify includes the value in the signature. A recorded answer then does not match a new request.
Seatify-Signing-KeyThe key ID of the embedded key. Seatify then signs with this key, also after you rotate keys.

Keep the nonce until the answer arrives. Your application needs the nonce to verify the answer.

curl -i https://license.seatify.dev/v1/ping \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Seatify-Signing-Key: $SEATIFY_SIGNING_KEY_ID" \
  -H "Seatify-Nonce: $(uuidgen)"

The answer carries the signature in these headers:

Date: Fri, 25 Sep 2026 21:28:39 GMT
Digest: sha-256=<SHA-256 of the body in Base64>
Seatify-Nonce: dd3c79ab-0581-45b2-aee6-6ddd7cf2095d
Seatify-Signature: keyid="<key id>", algorithm="ed25519", signature="<signature in Base64>", headers="(request-target) host date digest seatify-nonce"

{"message":"pong","api":"license","product":{"id":"<product id>","name":"Atlas Server","code":"ATLAS"}}

Verify the response

Verify every answer before your application uses it. If any check fails, your application must not use the answer.

  1. Compute the SHA-256 of the response body, exactly as your application received it. Encode the hash in standard Base64, and put sha-256= in front of it. Check that the result equals the Digest header.
  2. Read the parameters of the Seatify-Signature header. Each parameter has the form name="value". A comma and a space separate the parameters.
  3. Check that algorithm is ed25519 and that headers is (request-target) host date digest seatify-nonce.
  4. Find the embedded public key that has the key ID in keyid. If no embedded key has this ID, the answer is not valid.
  5. Build the signing string. See Signing string.
  6. Verify the Ed25519 signature in signature over the signing string. The signature is in standard Base64.

Build the signing string from the request that your application sent and from the digest that it computed. Do not copy these values from the answer. Take only the date from the answer.

This step runs inside your application. Choose a language tab to see the code.

Signing string

The signing string has five lines. A line feed (\n) separates the lines. There is no line feed after the last line.

LineValue
(request-target):The request method in lower case, a space, and the path with its query string. Use the path and the query string exactly as your application sent them.
host:The host that your application called, such as license.seatify.dev.
date:The value of the Date header of the answer.
digest:The digest that your application computed in check 1.
seatify-nonce:The nonce that your application sent. If your application sent no nonce, the line ends after the colon and the space.

For the ping request above, the signing string is:

(request-target): get /v1/ping
host: license.seatify.dev
date: Fri, 25 Sep 2026 21:28:39 GMT
digest: sha-256=<SHA-256 of the body in Base64>
seatify-nonce: dd3c79ab-0581-45b2-aee6-6ddd7cf2095d

Use the answer

Parse the body only after the signature is valid. Then decide on valid as usual. See Handle the answer.

Check the date

The signature covers the Date header, so nobody can change the date of an answer. Your application can compare this date with the clock of the device. Reject an answer whose date is too far from the clock. Choose a limit that fits your application, such as five minutes.

Your application can also store the date of each valid answer as the latest time that it has seen. The Offline validation guide uses this time to detect a clock that is set back.

When verification fails

SituationWhat your application does
The answer has no Seatify-Signature header.Do not use the answer to allow access. An answer with a status other than 200 is not signed. That includes every 400, 401 and 429. Handle the status as in Handle the answer.
The digest does not match, or the signature does not verify.Something changed the answer on the way. Handle the answer as if the API could not be reached.
No embedded key has the key ID.Send Seatify-Signing-Key with each request. Without it, Seatify signs with the active key, and the active key changes when you rotate keys.

A refusal with valid set to false is signed too. Your application can trust an expired answer as much as a valid one.

Some answers of the Distribution API are never signed, such as the download redirects. See Signed data.

If the License API cannot be reached, your application can use its license file. See Offline validation.

Next steps