Clavem

How to license a Tauri app: Rust checks, two key pairs and the updater

In a Tauri app, run the license check in a Rust command, store the key in the operating system's credential store, and give the web front end only a state such as licensed or needs-network. Keep the updater's signing key and the license token's key apart, because they do different jobs.

What is different about Tauri

A Tauri app is a web front end in the system’s webview, plus a Rust core. That split suits licensing. The front end draws the screens, and the Rust core does the work you do not want a web page to touch: reading the stored key, calling the License API and verifying the signed token.

Two facts shape the design. The front end can call the Rust commands you register, so register few. And the updater is its own system with its own signature scheme, which is easy to confuse with licensing.

Two key pairs, two jobs

Updater key pair License token key pair
Made by tauri signer generate Clavem, one per product
Private half You hold it, as TAURI_SIGNING_PRIVATE_KEY at build time Clavem holds it, encrypted, and signs tokens
Public half In tauri.conf.json as pubkey On your product page; compiled into the app
Signs Update bundles License tokens (sgt1.<payload>.<signature>)
If lost Tauri says you cannot publish updates to installed apps Not in your hands: Clavem stores the private half and you only ship the public half

Both are Ed25519, and both public halves live in your app, but they are unrelated. A token does not verify against the updater key, and an update bundle does not verify against the token key. When you debug a signature failure, first check which of the two you are looking at.

The Tauri documentation says the updater’s signature check “cannot be disabled”. That is good for security and has a side effect for licensing: there is no way to ship an unsigned test build through the updater, so keep the private key in your build environment even for staging.

Keep the check in Rust

Register three commands and nothing that returns the key:

// Skeleton only. The verification functions are in the offline verification docs.
#[tauri::command]
async fn license_state() -> String { /* "licensed" | "invalid" | "needs-network" | "unlicensed" */ }

#[tauri::command]
async fn license_activate(key: String) -> Result<(), String> { /* call /v1/licenses/activate, store, return Ok */ }

#[tauri::command]
async fn license_deactivate() -> Result<(), String> { /* call /v1/licenses/deactivate, clear storage */ }

The front end calls them with invoke('license_state'). It never sees the token or the instance id. If your settings screen shows the key, return a masked string from a separate command.

The verifier compiles and passes

Clavem’s offline documentation includes a Rust verifier, and notes that it was written from library documentation. I compiled it with ed25519-dalek 2, base64 0.22 and serde_json 1, and ran it against eight test tokens signed with a throwaway key pair:

Token Signature Licensed
Valid, fresh ok true
Payload changed after signing bad false
Signed by another key bad false
Past its refresh_by time ok false
License expired (valid: false) ok false
Another product (pid) ok false
Format version 2 ok false
Past its exp time ok false

The pattern to take from the table: a good signature alone is not enough. A token for an expired license verifies perfectly and must still be refused. This ran as a plain Rust program, not inside a Tauri app, which is where the function does not change.

Storing the key

Clavem’s Tauri guide uses the keyring crate, which talks to Keychain on macOS, the Credential Manager on Windows and the Secret Service on Linux. Store the key, the instance id and the last token in one entry as JSON. On Linux, a minimal desktop without a Secret Service provider has nowhere to put a secret. Catch that error, and ask for the key on each launch rather than writing it to a plain file.

Device fingerprint

The machine-uid crate returns the operating system’s machine id. Hash it before sending, and pass the hash as fingerprint at activation. Re-activating with the same fingerprint returns the same seat, so a reinstall does not use another. If a platform gives no stable id, leave fingerprint out. See machine fingerprinting pitfalls.

Updates for paying users

Tauri’s updater asks an endpoint for the latest version. The documentation describes two response styles: a static JSON file, or a dynamic server that answers 204 No Content when there is no update and 200 OK with JSON when there is. The JSON carries version, notes, pub_date, a url for the bundle and the signature, which is the content of the .sig file Tauri generates at build time. The JavaScript check() function can send custom request headers, so your own endpoint can receive the license key.

Clavem’s releases endpoint answers with a different shape: version, notes, published_at and a files list with signed, one-hour download links. It tells you whether a newer build exists and whether this license may download it. It does not return a Tauri signature, so it is not a drop-in feed.

Approach How it works Trade-off
Static latest.json on your own host Standard Tauri updater setup Anyone with the URL gets updates, paid or not
Clavem as the entitlement check, then send the user to the download The app calls the releases endpoint with X-License-Key, shows the notes, opens the link Update is manual, but gated by the license
A small adapter you run Receives the Tauri request, checks the key with Clavem, answers 204 or builds the JSON with the .sig text you store You run one more endpoint. I have not built or run this one

Pick the first for free updates to everyone, the second for the least code, and the third when you want in-app installs only for valid licenses. The same comparison problems apply to all three, and the update checks article covers them.

Test before you ship

Run the whole path on each operating system you support, because the credential store differs on each.

Check What to look for
Fresh install, no key license_state returns unlicensed and the paid screens stay closed
Activate with a valid key The state becomes licensed, and a second activation of the same machine does not use another seat
Pull the network cable The stored token carries the app through until refresh_by, 14 days after it was issued
Revoke the license in the dashboard The next online check returns valid: false, and the app drops to the free state without deleting user data
Stripe test-mode license It carries test_mode: true in the license_key object. Decide whether a release build accepts it
Linux without a Secret Service The app asks for the key on launch instead of failing

Write the first four as automated tests against a fake server that returns the response shapes in the API reference. The last three need a person and a machine.

Signing the app itself

Licensing does not replace operating-system signing. macOS wants a Developer ID certificate and notarization; Windows wants a signature if you want the smallest chance of SmartScreen warnings. Those are separate from both key pairs above. See code signing certificates explained.

Doing this with Clavem

Clavem provides the License API, the signed token and the public key on the product page. It has no Tauri plugin; the Rust code in the guides and the offline verification page is what you copy. The sequence is the same as in any app: activate once per machine, validate at launch with the saved instance id, fall back to the stored token for up to 14 days offline, and deactivate when the customer moves.

Questions

Is a Tauri app harder to crack than an Electron app?

The license check compiles into the Rust binary instead of shipping as readable JavaScript, which removes the easiest edits. A determined person can still patch a binary. Treat the check as a way to show honest customers the right state, and keep paid downloads and updates behind your server.

Does the Tauri updater use my license key?

No. The updater verifies each update bundle with its own Ed25519 key pair, set in tauri.conf.json. That key has nothing to do with your product's license-token key. You can still make the update endpoint check a license before it answers.

What happens if I lose the Tauri updater private key?

Tauri's documentation says you will not be able to publish new updates to users who already have the app installed. Back the key up as carefully as a code signing certificate.

Sources

  1. Tauri v2 updater plugin documentation (as of November 2026)
  2. Tauri v2 security, capabilities (as of November 2026)