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 dialog. Enter a valid Keymint license key, and the main app unlocks.
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 — Clean Svelte/React dialog with key entry and status
- Persistent state — License key and activation stored in app data directory
- Deactivation — Frees activation seat on user request
- Tauri commands —
activate_license,deactivate_license,is_activated,get_license_status
Configuration
Set environment variables before building:
bash
export KEYMINT_CLIENT_API_KEY=km_client_your_key
export KEYMINT_PRODUCT_ID=prod_Nx8K2mLpQ4rVtW9sBcOr add to src-tauri/.cargo/config.toml:
toml
[env]
KEYMINT_CLIENT_API_KEY = "km_client_your_key"
KEYMINT_PRODUCT_ID = "prod_Nx8K2mLpQ4rVtW9sBc"| 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
│ └── license.rs # Keymint REST API calls (reqwest), state persistence
├── Cargo.toml # Rust dependencies
└── .cargo/
└── config.toml # Build-time env vars (API key, product ID)
src/ # Webview frontend (Svelte/React/Vue)
├── lib/
│ └── Activation.svelte # Activation UI component
└── App.svelte # Main app (gated on license check)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- The
clientscope only allows activation, deactivation, and floating session management - License state is stored in the OS app data directory (
dirs::data_local_dir())
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