Migrating from Electron
The Tauri SDK stores the same data, in the same places, and computes the same fingerprint as the Electron SDK. When a customer updates from the Electron build of your app to the Tauri build, on the same computer:
- they’re still activated: the Tauri build reads the key and token the Electron build stored,
- they keep the same machine on their license: no new place is taken, and
machine_limit_reachedcan’t happen because of the move, - they can stay offline through the update: the stored token is valid for both.
Steps
Keep the same product
Use the same product id and public key as your Electron build. A new product would have its own keys: your customers’ licenses wouldn’t work in it.
Keep the same fingerprint option
If your Electron build passed fingerprint, pass the same value to the Tauri plugin’s fingerprint. Without it on both sides, there’s nothing to do. See overriding the machine id.
Keep the version going up
The Tauri build’s version comes from tauri.conf.json. Continue your Electron numbering, like from 2.3.1 to 2.4.0: licenses that include 2.x keep working, and a license whose updates ended before your Tauri release is refused with VERSION_NOT_ALLOWED, as for any release.
Move the code
Your main process code moves to Rust, and your IPC handlers and preload script go away: see the mapping below.
API mapping
| Electron | Tauri, Rust | Tauri, webview |
|---|---|---|
new LicenseManager({ productId, publicKey, … }) | Builder::new(product_id, public_key)….build(), registered with .plugin() | |
license.ready() | app.license().ready().await | ready() |
license.getState() | app.license().state() | getState() |
license.onStateChange(fn) | app.license().on_state_change(fn), subscribe() | onStateChange(fn), watchLicense(fn) |
license.setLicenseKey(key) | app.license().set_license_key(&key).await | setLicenseKey(key) |
license.refresh() | app.license().refresh().await | refresh() |
license.getOfflineState() | app.license().offline_state() | getOfflineState() |
license.getLatestAllowedVersion() | app.license().latest_allowed_version() | getLatestAllowedVersion() |
license.getPortalUrl() | app.license().portal_url() | getPortalUrl() |
license.getLicenseKey() | app.license().license_key() | getLicenseKey() (extra permission), getLicenseKeyHint() |
license.getFingerprint() | app.license().fingerprint().await | getFingerprint() (extra permission) |
license.isClockTampered() | app.license().is_clock_tampered() | isClockTampered() |
license.dispose() | Done by the plugin on exit | |
minOfflineDurationMs: n | .min_offline_duration(Duration::from_millis(n)) | |
machineName, platform, version, fingerprint | .machine_name(), .platform(), .version(), .fingerprint() | |
ipcMain.handle(…) + preload script | Not needed: the plugin’s commands and permissions | |
shell.openExternal(url) | openUrl(url), from @tauri-apps/plugin-opener |
The states, the error codes and the behavior are the same. One difference helps: in Tauri, errors keep their code between Rust and the webview, so you don’t need to turn them into plain objects like with Electron’s IPC.
The macOS Keychain prompt
On macOS, a Keychain item belongs to the app that created it, identified by its code signature. The Tauri build is a new app for the Keychain: the first time it reads an item the Electron build wrote, macOS asks the customer to allow access, once.
- When they allow it, everything works as before.
- When they deny it, nothing breaks: the SDK reads the same values from its files, which both builds write.
Mention it in your release notes, like “macOS may ask once to let the new version read your license: click Always Allow.” On Windows and Linux, there’s no prompt.
Edge cases
Both builds installed side by side, like during a beta. They share the same stored data: activating in one activates the other, on the same machine.
A customer moving to the Tauri build on a new computer is a new machine, like with any new computer.
A machine whose id can’t be read, and falls back on its MAC address. The two SDKs may pick different network interfaces: that computer may become a new machine. It’s rare, since the native machine id is available on nearly every computer.