Activate a licence in Tauri

In this guide

Let the WebView collect the buyer’s key and hand activation to the Rust backend. A Tauri command returns the enabled features to the window. Keep the certificate and signing-key map on the Rust side.

To use the SDK, follow the client SDK integration guide.

Prepare the app

Add reqwest with its json feature, serde_json and ring to the Rust project. Reuse an HTTPS client with a bounded timeout. Keep the fingerprint and licence state in private application data. The functions below prepare JSON requests for the public API. Download tauri.rs.

Pin your product slug (here dropsmith) and your organisation’s test public keys in the build. Obtain those keys at build time as described in the verification protocol. Keep management credentials and privileged calls on the publisher’s server.

Activate the first machine

Pass the key the buyer just typed and the local fingerprint to this function. Replace the sample machine name, platform, version and build date with your app’s values. A successful POST /v1/activate returns 200 with activation_id and certificate.

pub fn activate(http: &Client, key: &str, fingerprint: &str) -> RequestBuilder {
    http.post(format!("{API}/activate"))
        .json(&json!({
            "key": key, "product": PRODUCT, "fingerprint": fingerprint,
            "machine_name": "Studio", "platform": std::env::consts::OS,
            "app_version": "1.0.0", "build_date": "2026-11-17"
        }))
}

Send the request from your asynchronous Tauri command with let response = activate(&http, &key, &fingerprint).send().await?;.

If every seat is taken (seats_exhausted), let the buyer release a machine. You can discard the entered key. Refresh sends activation_id, the original fingerprint and the current app_version.

Verify before granting access

Require two canonical base64url segments after keyseal:v1:. Read the kid from the UTF-8 JSON to select its pinned public key. Pass that key, the original payload segment as received and the 64 signature bytes to the function below. The ring::signature::ED25519 primitive verifies the segment bytes with the raw key. Treat a false result as bad_signature.

pub fn valid_signature(public_key: &[u8], segment: &str, signature: &[u8]) -> bool {
    UnparsedPublicKey::new(&ED25519, public_key)
        .verify(segment.as_bytes(), signature)
        .is_ok()
}

The signature is one step in the complete verification procedure. Check every signed claim, the expected product and the fingerprint’s SHA-256. Match act to the ID in the response, then replace the stored ID and certificate together. Run the protocol’s 19 vectors, including modified signatures and retired keys.

Start offline, refresh and release

Verify the stored certificate on every launch. When the network is unavailable, an active lease allows use. At or beyond lease_until, open preserves the last verified entitlements and closed blocks use until a successful refresh. Check the build’s date against updates_until as well.

pub fn refresh(http: &Client, id: &str, fingerprint: &str) -> RequestBuilder {
    http.post(format!("{API}/refresh"))
        .json(&json!({"activation_id": id, "fingerprint": fingerprint, "app_version": "1.0.0"}))
}

pub fn deactivate(http: &Client, id: &str, fingerprint: &str) -> RequestBuilder {
    http.post(format!("{API}/deactivate"))
        .json(&json!({"activation_id": id, "fingerprint": fingerprint}))
}

Send these requests in the same way, with refresh(&http, &id, &fingerprint).send().await? or deactivate(&http, &id, &fingerprint).send().await?.

Call POST /v1/refresh in the background once a day when online. Verify a new certificate before replacing the previous one. Immediately persist a blocked state on revoked, suspended or expired, retain the ID and continue refreshing. For released, unknown_activation or wrong_machine, clear the activation and offer to activate again. A network failure or 429 preserves the previous state according to its lease.

The “Release this machine” action calls POST /v1/deactivate. On 204, clear the certificate and ID without reading a JSON body. An unknown activation or one belonging to a different machine can also be forgotten. On network failure, leave the release pending.

All guides