Tauri License Starter
Clone-and-run Tauri v2 app with Keymint license activation pre-configured in Rust. Machine binding, activation UI, and license state persistence included.
Quick Start
bash
git clone https://github.com/keymint-dev/keymint-tauri-starter.git
cd keymint-tauri-starter
npm install
# Edit src-tauri/.cargo/config.toml with your KEYMINT_CLIENT_API_KEY and KEYMINT_PRODUCT_ID
npm run tauri devOpens a Tauri window with an activation form. Enter a valid Keymint license key and the form shows the activation result. The starter has no main view behind the license; gate your own UI on the is_activated command.
What's Included
- Rust license backend —
reqwestHTTP calls to Keymint API from Tauri commands - Hardware fingerprint —
machine-uidcrate for stable host ID across platforms - Activation UI — a plain HTML page (
src/index.html, no framework) with a key field that calls the Rustactivate_licensecommand throughinvoke() - Persistent state — License key and activation state stored in
license.jsonunder the OS local data directory - Deactivation — the
deactivate_licensecommand frees the activation seat. The starter's page has no button for it; call it from your own UI - Tauri commands —
activate_license,deactivate_license,is_activated,get_license_status
Configuration
Set environment variables before building:
bash
export KEYMINT_CLIENT_API_KEY=km_live_your_client_key
export KEYMINT_PRODUCT_ID=YOUR_PRODUCT_IDOr add to src-tauri/.cargo/config.toml:
toml
[env]
KEYMINT_CLIENT_API_KEY = "km_live_your_client_key"
KEYMINT_PRODUCT_ID = "YOUR_PRODUCT_ID"| Variable | Where to Find It |
|---|---|
KEYMINT_CLIENT_API_KEY | Keymint Dashboard → Developer → API Keys (client scope) |
KEYMINT_PRODUCT_ID | Keymint Dashboard → Products |
Project Structure
text
src-tauri/
├── src/
│ ├── main.rs # Tauri app setup, command registration
│ ├── lib.rs # Library target (mobile builds and cargo test)
│ └── license.rs # Keymint REST API calls (reqwest), state persistence
├── Cargo.toml # Rust dependencies
├── tauri.conf.json # Tauri config
└── .cargo/
└── config.toml # Build-time env vars (API key, product ID)
src/
└── index.html # Webview frontend: activation form (plain HTML/JS)API Endpoints Called from Rust
| Endpoint | Method | Purpose |
|---|---|---|
POST /key/activate | reqwest::Client::post() | Validate license and bind to machine |
POST /key/deactivate | reqwest::Client::post() | Free activation seat |
Tauri Commands
| Command | Returns | Purpose |
|---|---|---|
activate_license(key) | Result<String, String> | Activate with key, returns message |
deactivate_license() | Result<String, String> | Deactivate, free seat |
is_activated() | bool | Check current activation state |
get_license_status() | JSON | Return masked key + status for UI |
Security
KEYMINT_CLIENT_API_KEYis compiled into the Rust binary viaoption_env!()— not exposed to the webview, but extractable from the binary, so use aclientkey only- The
clientscope only allows activation, deactivation, and floating session management - License state is stored as plain JSON in the OS local data directory (
dirs::data_local_dir()/tauri-license-starter/license.json)
Build & Package
bash
npm run tauri buildProduces platform-specific installers in src-tauri/target/release/bundle/.
Next Steps
- Add floating license support for concurrent seat licensing
- Add periodic license health checks to detect revocations
- Wire up Stripe subscription licensing for paid plans