Skip to content
Offline validation

Offline validation

This guide adds offline validation to your application. At the end, your application checks out a signed license file while it is online. When there is no network, your application verifies the file and checks the license from the file.

Before you start

  • Your application claims and validates licenses. See Add your application.
  • The policy of the license allows offline validation. Set the license file lifetime, and choose whether to encrypt license files. See Offline validation on the Policies page.
  • 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. In curl, the keys and the fingerprint are the variables $SEATIFY_PUBLISHABLE_KEY, $SEATIFY_SIGNING_KEY_ID, $LICENSE_KEY and $DEVICE_FINGERPRINT. 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. Your application checks every license file with this key. Never download the key at run time.

You can embed more than one key. Each file names the key ID of the key that signed it. After you rotate keys, a new build embeds the new key, and older builds keep the old key. See Rotate signing keys.

Your application also knows the algorithm of its license files. The algorithm is aes-256-gcm+ed25519 if the policy encrypts license files. It is base64+ed25519 if the policy does not encrypt them.

Claim the license

If the policy binds devices, claim the license on the device first. Check-out does not claim the license. A check-out from a device that has not claimed the license fails with not_claimed. See Claim the license.

If the policy does not bind devices, skip this step.

Check out the license file

Check out a license file after each successful validation. Send the stored license key and the fingerprint. Name the embedded key in the Seatify-Signing-Key header. Seatify then signs the file with that key.

curl https://license.seatify.dev/v1/licenses/check-out \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Seatify-Signing-Key: $SEATIFY_SIGNING_KEY_ID" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT" }
}
EOF

A successful check-out answers with valid set to true:

{
  "valid": true,
  "reason": null,
  "certificate": "-----BEGIN SEATIFY LICENSE FILE-----\neyJlbmMiOiI4aWV4NnlLMTNCVHN5U2JzR0dEMVJ5enAySjlNbjdURkNqSEVYVmZKRUFBNk9UcVBpemFn\n…\n-----END SEATIFY LICENSE FILE-----",
  "issued": "2026-09-25T16:16:41Z",
  "expires_at": "2026-10-25T16:16:41Z",
  "ttl": 2592000
}

The certificate field is the license file. The file is valid until expires_at. The ttl field is the lifetime of the file in seconds.

If valid is false, the reason field names the cause, and the other fields are null. See Check-out refusals.

The answer is signed like every other License API answer. See Verify signed responses.

Store the license file

Store the certificate and its expires_at on the device, next to the license key. Replace the stored file after each successful check-out.

Your application checks out a new file after each online validation. The stored file is then always new. A device that goes offline can use the file for its full lifetime.

Verify the file

When your application cannot reach the License API, it verifies the stored file. If any check fails, your application must not use the file.

  1. Remove the BEGIN and END lines. Join the other lines, and decode them from Base64. The result is a JSON object with the fields enc, sig, alg and kid.
  2. Check that alg is the algorithm that your application expects. Never let the file choose the algorithm.
  3. Find the embedded public key that has the key ID in kid. If no embedded key has this ID, the file is not valid.
  4. Verify the Ed25519 signature in sig. The signature covers the text license/, followed by the value of enc.
  5. Read the contents. For base64+ed25519, decode enc from Base64. For aes-256-gcm+ed25519, decrypt enc. See Encrypted files.

All Base64 in the file is standard Base64 with padding.

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

Encrypted files

The value of enc has three parts, separated by dots: the ciphertext, the IV and the tag. Each part is Base64. Decrypt the ciphertext with AES-256-GCM.

The AES key is the SHA-256 of a text that your application builds:

FileText to hash
For one deviceThe license key, followed by the SHA-256 of the fingerprint in lower-case hex.
For the whole licenseThe license key.

Use the license key in upper case, as your application stored it. A file is for one device when the policy binds devices. A file for another device does not decrypt.

Check the contents

After the signature, check that the file is for this license and this device. Also check that the file has not expired.

  1. The time now is between meta.issued and meta.expiry. When the file has expired, your application must go online again.
  2. license.key_hash is the SHA-256 of the stored license key, in lower-case hex.
  3. If meta.scope is not null, meta.scope.fingerprint_hash is the SHA-256 of the fingerprint of this device, in lower-case hex.

Store the latest time that your application has seen. If the clock of the device shows an earlier time, do not trust the file. A clock that is set back must not make an old file valid again.

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

Check the license

The file holds the license as it was at check-out. Work out the status of the license again from the file. Use the expiry date of the license, the grace period and the After expiry rule:

Time nowStatusValid
The license has no expires_at.activeYes
Before license.expires_atactiveYes
Before license.expires_at plus expiration.grace_period_secondsgraceYes
LaterexpiredOnly if expiration.strategy is keep_access or perpetual_fallback

If grace_period_seconds is null, the policy has no grace period. Then use the entitlements and the limits in the file, as your application uses them from a validation. See Statuses.

License file contents

The contents of a license file are JSON. The field names are the same as in a validation answer.

FieldDescription
metaThe file itself: issued, expiry, ttl in seconds and scope. The scope is null for a file for the whole license. For a file for one device, the scope holds fingerprint_hash.
licenseid, name, key_hash, expires_at and activated_at. status and expired are the values at check-out.
limitsmax_devices, max_seats and max_processes. null means that there is no limit.
entitlementsThe entitlements of the license. Each one has a code and a name.
heartbeatWhether the policy requires heartbeats, with the interval and the grace in seconds.
expirationThe After expiry rule in strategy, and the grace period in grace_period_seconds.

The file holds no license key and no fingerprint. It holds only their SHA-256 hashes.

This file is for one device:

{
  "meta": {
    "issued": "2026-09-25T16:16:41Z",
    "expiry": "2026-10-25T16:16:41Z",
    "ttl": 2592000,
    "scope": {
      "fingerprint_hash": "<SHA-256 of the fingerprint>"
    }
  },
  "license": {
    "id": "<license id>",
    "name": "Studio team",
    "key_hash": "<SHA-256 of the license key>",
    "expires_at": "2026-10-22T23:00:00Z",
    "activated_at": "2026-01-29T01:41:17Z",
    "status": "active",
    "expired": false
  },
  "limits": {
    "max_devices": 6,
    "max_seats": null,
    "max_processes": 1
  },
  "entitlements": [
    {
      "code": "API_ACCESS",
      "name": "API Access"
    },
    {
      "code": "AUDIT_LOG",
      "name": "Audit Log"
    }
  ],
  "heartbeat": {
    "required": false,
    "interval_seconds": null,
    "grace_seconds": null
  },
  "expiration": {
    "strategy": "keep_access",
    "grace_period_seconds": null
  }
}

When the file is not valid

SituationWhat your application does
The License API answers.Use the online answer, because it is newer than the file. If the answer has valid set to false, remove the stored file.
There is no stored file.Ask the user to connect to the internet.
The file has expired.Ask the user to connect to the internet. The next check-out gives a new file.
A check fails.Remove the stored file. Ask the user to connect to the internet.

For a device that never connects to the internet, see Devices with no internet.

Check-out refusals

Check-out answers every licensing outcome with the status 200, a refusal too. The reason field names the cause.

ReasonCauseWhat your application does
offline_validation_not_enabledThe policy does not allow offline validation.Turn on offline validation in the policy.
license_not_foundThe key is not known.Ask the user to enter the key again.
product_mismatchThe key belongs to another product.Ask the user for the right key.
suspendedThe license is suspended.Remove the stored file, and tell the user.
expiredThe license has expired, and the After expiry rule is Expire.Remove the stored file, and tell the user.
device_requiredThe policy binds devices, and the request has no device.Send the fingerprint.
not_claimedThe device has not claimed the license, or its heartbeat lease has ended.Claim the license again. Then check out the file again.

Other statuses mean that the request itself is wrong:

StatusCause
400The body is not valid, or Seatify-Signing-Key names a key that is not known.
401The publishable key is missing or not valid.
429Your application sent too many requests. Try again later.

Limits of offline files

  • A file works until it expires. A suspended or deleted license keeps working offline until then. A shorter license file lifetime makes this time shorter.
  • Check-out does not renew a heartbeat lease. If the policy requires heartbeats, the lease can end while the device is offline. Seatify then frees the device slot, but the file still works until it expires.
  • Encryption stops a person from reading the file in a text editor. A person who has the license key can still decrypt the file. The signature protects the file from changes.
  • A file that a deleted signing key signed still verifies until the file expires. Seatify signs no new files with a deleted key.

Next steps