Skip to content
Updates and download links

Updates and download links

This guide adds an update check to your application and puts download links on your download page. At the end, your application finds, downloads and verifies a new release. Each link on your download page leads to the newest release.

Before you start

The examples call https://dist.seatify.dev. In curl, the product ID, the license key and the key ID of your signing key are the variables $PRODUCT_ID, $LICENSE_KEY and $SEATIFY_SIGNING_KEY_ID. In the other languages, they are variables of your application.

Update your application

Check for an update

Send the version that your application runs, with its platform and its architecture. The version is a semantic version without a v prefix. Send the platform and the architecture together, or leave out both. See Platforms and architectures.

If a release has several files for one platform, such as a .dmg and a .zip, add filetype, such as filetype=dmg.

Send the nonce and the key ID too, and verify the answer before your application uses it. Your application trusts the SHA-256 of the file only from a verified answer.

curl "https://dist.seatify.dev/v1/products/$PRODUCT_ID/update?version=1.1.0&platform=darwin&arch=arm64" \
  -H "Seatify-License-Key: $LICENSE_KEY" \
  -H "Seatify-Signing-Key: $SEATIFY_SIGNING_KEY_ID" \
  -H "Seatify-Nonce: $(uuidgen)"

The answer offers the newer release in update. See Check the update for a full answer. Your application uses these fields:

FieldDescription
update.versionThe version to install.
update.name, update.notesThe name and the release notes. Your application can show them to the user.
update.artifactThe file for the platform, the architecture and the file type of the check. It is null when several files of the release match. A check without a platform matches every file. Then choose a file from update.artifacts.
update.artifact.urlThe address to download the file from.
update.artifact.sha256, update.artifact.signature, update.artifact.signing_key_idThe values that verify the file.

When your application runs the newest version that it can install, update is null:

{
  "valid": true,
  "reason": null,
  "current": "1.2.0",
  "update": null
}

Download the file

Request update.artifact.url with the license key. The answer is a redirect with the status 303 to a signed download link. Your HTTP client follows the redirect.

Check the status before you save the file. A refused download answers a status other than 200. See Handle the answer.

curl --fail --location --remote-name \
  -H "Seatify-License-Key: $LICENSE_KEY" \
  "https://dist.seatify.dev/v1/products/$PRODUCT_ID/releases/1.2.0/artifacts/BEACON-1.2.0-universal.dmg"

The redirect is not signed. Your application checks the file itself in the next step.

Verify the file

Verify the file before your application installs it. If a check fails, delete the file.

  1. Compute the SHA-256 of the file in lower-case hex. It must equal update.artifact.sha256.
  2. Find the embedded public key that has the key ID in signing_key_id.
  3. Check the Ed25519 signature in signature with this key. The signed message is the text artifact/ followed by the SHA-256 from check 1. The signature is in standard Base64.

If no embedded key has the key ID, the SHA-256 check is enough. The SHA-256 came in an answer that your application verified. This happens after you rotate signing keys. See Updates across a rotation.

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

Install the update

Install the file only after both checks pass. The installation depends on your platform and your installer.

Handle the answer

The update check answers every licensing outcome with the status 200, a refusal too. A download answers a refusal with an HTTP status instead. An HTTP client that follows a download would otherwise save the refusal as the file.

AnswerAnswered byWhat your application does
update is nullUpdate checkNo action is needed. Your application runs the newest version that it can install.
update.artifact is nullUpdate checkAdd filetype to the check, or choose a file from update.artifacts.
suspendedUpdate check, and download with the status 403Tell the user that the license is suspended.
expiredUpdate check, and download with the status 403Tell the user that the license has expired. The After expiry rule of the policy ends access to releases.
product_mismatchUpdate check, and download with the status 403The key belongs to another product. Ask the user for the right key.
release_not_coveredDownload with the status 403The license has expired, and the release was published after the expiry date. The update check never offers such a release.

The reason is in the reason field of the answer, also for a 403. Other statuses mean that the request itself is wrong:

StatusCause
400The query is not valid. The errors field names each field that is wrong.
401The license key is missing on a licensed product, or the key is not valid.
404Download only. The release or the file does not exist, or the release is a draft or yanked.
429Your application sent too many requests. Try again later.

Beta and version lines

The update check stays in the channel of the version that your application runs. A beta build sees beta, release candidate and stable releases. A stable build sees only stable releases. See Channels.

  • To let the user join the beta, send channel=beta with the check.
  • To let the user leave the beta, send channel=stable. Your application keeps its beta build until a stable release with a higher version is published. For example, 1.3.0 is higher than 1.3.0-beta.2.
  • To keep your application on one major version, send constraint=2. The check then offers only 2.x.y versions. Use it when version 3 needs a new license. See Newest release.

Resume a download

The signed download link accepts a Range header, so your application can resume a download that stopped. The link expires. Request update.artifact.url again for a new link.

Each request of update.artifact.url counts as a download.

Update frameworks

Seatify serves update endpoints for Tauri, Sparkle, WinSparkle and electron-updater. An application that uses one of these frameworks reads its endpoint instead of the update check. See Update a Tauri application, Update a Sparkle application, Update a WinSparkle application and Update an Electron application.

For another update framework, your application calls the update check and downloads the file itself. If your framework checks its own signature of the file, add this signature to the file in the dashboard. The update check returns it unchanged in vendor_signature. Seatify does not check it.

Put download links on your page

A stable download link names a platform, an architecture and a file type. It names no version and no filename. So the link stays the same when you publish a new release.

A browser sends no header when it follows a link. So a stable download link works on a web page only for an open product. For a licensed product, see Licensed products.

Copy the links

Copy the links from the Download links section of the product in the dashboard. The dashboard shows one link for each file of the newest release.

FileLink
macOShttps://dist.seatify.dev/v1/products/<product id>/download?platform=darwin&arch=universal&filetype=dmg
Windowshttps://dist.seatify.dev/v1/products/<product id>/download?platform=windows&arch=amd64&filetype=exe
Linuxhttps://dist.seatify.dev/v1/products/<product id>/download?platform=linux&arch=amd64&filetype=tar.gz

Add the links to your page

<a href="https://dist.seatify.dev/v1/products/<product id>/download?platform=darwin&arch=universal&filetype=dmg">Download for macOS</a>
<a href="https://dist.seatify.dev/v1/products/<product id>/download?platform=windows&arch=amd64&filetype=exe">Download for Windows</a>
<a href="https://dist.seatify.dev/v1/products/<product id>/download?platform=linux&arch=amd64&filetype=tar.gz">Download for Linux</a>

A click answers a redirect to a signed download link. The browser saves the file under its filename.

Test the links

Download each link once. The file must be the file of the newest release.

curl --fail --location --remote-name --remote-header-name \
  "https://dist.seatify.dev/v1/products/$PRODUCT_ID/download?platform=darwin&arch=universal&filetype=dmg"

Link rules

  • A link leads to the newest release in the stable channel that has a matching file. A release without a matching file is skipped. A fix for Windows only then does not change the macOS link.
  • A universal build matches a link for any architecture. A build for the exact architecture wins over a universal build.
  • If several files of one release match, the link fails with the status 404. Add filetype to the link. The links from the dashboard already name the file type.
  • A link for a platform that no release has a file for fails with the status 404.
  • Add channel=beta to a link for the newest beta. Add constraint=2 to keep a link on version 2. The dashboard adds both when you choose a channel and a version line.
  • Each download through a link counts as a download.

Licensed products

A download of a licensed product needs a valid license key for the product. A browser cannot send the key, so your server requests the link instead. Your server must know the license key of the customer, for example from the account of the customer.

Request the link

Request the stable download link with the license key in the Seatify-License-Key header. Do not follow the redirect. The answer has the status 303, and its Location header is a signed download link.

A refused request answers a status other than 303. See Handle the answer.

curl --silent --output /dev/null --write-out "%{http_code} %{redirect_url}\n" \
  -H "Seatify-License-Key: $LICENSE_KEY" \
  "https://dist.seatify.dev/v1/products/$PRODUCT_ID/download?platform=darwin&arch=universal&filetype=dmg"

The JavaScript example runs on a server, such as Node.js. A browser hides the Location header of a redirect that it does not follow.

Send the browser to the file

Answer the request of the browser with a redirect to location. The browser saves the file under its filename.

The signed download link expires. Anyone who has the link can use it until it expires. So request a new link for each download, and do not store it.

Each request of the link counts as a download in the activity of the license.

Next steps