Clavem

Software update checks and downloads in a Tauri app

Call the releases endpoint from a Rust command with the license key in a header, compare versions with semver, stream the installer with progress events, and open it. Tauri's updater plugin expects its own signed feed, which Clavem's response is not.

Clavem keeps your builds and answers GET /v1/releases/:productId/latest. A valid license gets release notes and files with signed download links, and any other key gets only the version. The release docs list every field. In Tauri there is a choice to make first: use the official updater plugin, or check and download yourself.

Why the updater plugin does not point at Clavem

Tauri’s updater plugin installs the update itself, and it verifies a signature before it does. Its documentation says the signature requirement cannot be disabled. The signing key is Tauri’s own, the public half goes in tauri.conf.json, and the server answers with a JSON object that has a version, a url and a signature, or 204 No Content when there is no update. Clavem’s response has files with signed links and no such signature, so the plugin cannot read it.

You have two ways to proceed. Run the check and download yourself and hand the installer to the operating system, which this page does. Or host a small endpoint of your own that asks Clavem about the license and answers in the updater’s format, with signatures from your build pipeline. The second keeps in-place installs, and it is a service you run.

Check from a command

A Rust command returns a state, so the webview needs no HTTP code:

use serde::Serialize;

#[derive(Serialize, Debug)]
#[serde(tag = "state", rename_all = "kebab-case")]
pub enum UpdateState {
    UpToDate,
    Available { version: String, notes: Option<String> },
    Locked { version: String },     // newer, but no valid license: the response has no links
    Failed { reason: String },
}

pub async fn check(http: &reqwest::Client, base: &str, product_id: u64, current: &str,
                   key: Option<&str>, platform: &str) -> (UpdateState, Option<Release>) {
    let mut req = http.get(format!("{base}/v1/releases/{product_id}/latest")).query(&[("platform", platform)]);
    if let Some(key) = key { req = req.header("X-License-Key", key); }
    let Ok(res) = req.send().await else { return (UpdateState::Failed { reason: "offline".into() }, None) };
    match res.status().as_u16() {
        200 => {}
        404 => return (UpdateState::UpToDate, None),   // nothing published yet
        429 => return (UpdateState::Failed { reason: "rate limited, try again in a minute".into() }, None),
        s => return (UpdateState::Failed { reason: format!("HTTP {s}") }, None),
    }
    let Ok(release) = res.json::<Release>().await else { return (UpdateState::Failed { reason: "unreadable reply".into() }, None) };
    let (Ok(latest), Ok(current)) = (semver::Version::parse(&release.version), semver::Version::parse(current))
        else { return (UpdateState::Failed { reason: "version is not semver".into() }, None) };
    if latest <= current { return (UpdateState::UpToDate, None); }
    if release.files.iter().any(|f| f.url.is_some()) {
        (UpdateState::Available { version: release.version.clone(), notes: release.notes.clone() }, Some(release))
    } else {
        (UpdateState::Locked { version: release.version.clone() }, None)
    }
}

Release and ReleaseFile are the serde structs from updates in Rust. The http client is the one in managed state from validation in Tauri. Against a local stub with release 3.2.1 and the app on 3.2.0, and one live call, the JSON the webview gets was:

with key:     {"state":"available","version":"3.2.1","notes":"Fixes a crash when importing large files."}
without key:  {"state":"locked","version":"3.2.1"}
on 3.2.1:     {"state":"up-to-date"}
live demo:    {"state":"up-to-date"}

The live demo product has no published release, so the real API answers 404 with not_found and the command maps it to up to date. locked is worth a screen of its own. A lapsed customer learns that 3.2.1 exists and can be sent to renew.

Download with progress, when the user clicks

Do not keep the link from the check. It lasts one hour. The command below checks again, so the link is fresh, streams the file, emits progress and opens the installer:

use tauri::{AppHandle, Emitter, Manager};
use tauri_plugin_opener::OpenerExt;

#[tauri::command]
pub async fn install_update(app: AppHandle, licensing: tauri::State<'_, Licensing>) -> Result<(), String> {
    let saved = load().ok_or("No license is saved.")?;
    let label = format!("{}-{}", std::env::consts::OS, std::env::consts::ARCH); // for example macos-aarch64
    let (_, release) = check(&licensing.http, BASE, PRODUCT_ID, &app.package_info().version.to_string(), Some(&saved.key), &label).await;
    let file = release.and_then(|r| r.files.into_iter().find(|f| f.url.is_some())).ok_or("No update is available for this license.")?;

    let dest = app.path().download_dir().map_err(|e| e.to_string())?.join(&file.filename);
    let last = std::sync::atomic::AtomicU64::new(101);
    download(&licensing.http, &file, &dest, |done, total| {
        let percent = done * 100 / total;
        if last.swap(percent, std::sync::atomic::Ordering::Relaxed) != percent {
            let _ = app.emit("update-progress", percent);   // one event per whole percent
        }
    }).await?;
    app.opener().open_path(dest.to_string_lossy(), None::<&str>).map_err(|e| e.to_string())
}

download streams with bytes_stream, appends to <name>.part, resumes with Range: bytes=N- and renames only when the size equals the size field. It is the same logic as in the Rust guide, on tokio::fs. Run against the stub with 1 MiB already in the .part file of a 3 MiB file, it resumed and finished at 3,145,728 bytes, and a link with a bad signature returned the expired-link error, which is the 403 path. The response has no checksum field, so size is the only integrity check Clavem provides. Sign your installers, and let the operating system check the signature.

Front end

import { listen } from '@tauri-apps/api/event';
import { invoke } from '@tauri-apps/api/core';

await listen('update-progress', (e) => setProgress(e.payload));
await invoke('install_update');   // resolves when the installer has been opened

Things specific to Tauri

  • Events are JSON over IPC. A stream of 16 KB chunks without throttling becomes thousands of events. One per whole percent is plenty.
  • package_info().version comes from tauri.conf.json or Cargo.toml, so bump one version in one place per release, or the check keeps offering what the user has.
  • Linux AppImage and deb differ. Upload a file per format and label each, for example linux-x86_64-appimage, so the command asks for the format the user installed.
  • An installer you open is not an update in place. The user still has to finish the installer. That is the price of not hosting the updater feed.

Limits and timing

The releases endpoint allows 120 requests a minute per IP address, counted apart from validation. Check once at startup or once a day. “Latest” is the most recently published release, so a backport published after 3.2.1 becomes the answer. See the release docs.

Doing this with Clavem

Upload each installer once, give it a platform label, publish, and the same key that turns the app on fetches the download. Imported licenses have no order page, so this endpoint is how they get builds.

Questions

Can the Tauri updater plugin read Clavem's release endpoint?

Not directly. The updater expects a response with a version, a download url and a signature made with Tauri's own signing key, and answers 204 when there is no update. Clavem's response carries files and signed links but no such signature field.

How do I show download progress in a Tauri app?

Stream the file in Rust and emit an event with the bytes done and the total. Emit only when the whole percentage changes, because every event crosses the IPC boundary as JSON.

What platform label should I use?

Whatever you chose when uploading. A label like macos-aarch64 or windows-x86_64 built from the OS and ARCH constants works, and a file with no label is offered to every platform.

Sources

  1. Tauri 2, Updater plugin (checked November 2026)
  2. Tauri 2, Opener plugin (checked November 2026)
  3. Tauri 2, Calling the frontend from Rust (checked November 2026)