Electron SDK
@licenseman/electron does the whole integration for an Electron app: it validates the key the customer enters, computes a stable machine fingerprint, stores the key and the license token in the system keychain, verifies the token offline, renews it in the background, and tells your app, at any time, in one state, whether it should unlock.
Your code creates one LicenseManager, shows an activation screen when the state asks for a key, and reacts to state changes. Everything else is done for you.
import { LicenseManager } from "@licenseman/electron";
const license = new LicenseManager({
productId: "x7Kp2QaZ",
publicKey: "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA…\n-----END PUBLIC KEY-----",
});
license.onStateChange((state) => updateUi(state));
const state = await license.ready(); // "ACTIVE", "MISSING_KEY", "EXPIRED"…
What the SDK does
| Validates on every launch | When online, the stored key is validated again on each launch, so an expired license or a deactivated machine is noticed right away. With a valid stored token, it runs in the background, without delaying startup. See validation and renewal. |
| Works offline | When LicenseManager can’t be reached, the app keeps running on the stored token until it expires. See working offline. |
| Renews in the background | The key is validated again before the token expires. Transient failures are retried, and while offline, the SDK keeps trying with a backoff. |
| Locks only when it should | Only the four errors that say something about the license lock the app. A network error, a 500 or a 402 never do. |
| Detects clock tampering | A clock set back to keep using an expired token is detected while offline. See clock tampering. |
| Fingerprints the machine | From the system’s machine id and a random id stored in the keychain, specific to your product. See machine fingerprint. |
| Stores secrets safely | In the macOS Keychain, the Windows Credential Manager or the Linux Secret Service, with a file fallback. See stored data. |
Requirements
- Electron 28 or later, and Node.js 18 or later for tests and tooling.
- The SDK runs in the main process only: it uses Node.js modules and Electron’s
app. Your windows talk to it through IPC: see renderer and IPC. - Your product’s id and your organization’s public key, from the Security page. See what you need.
It’s published as both ESM and CommonJS, with TypeScript types.
How it works
The pages of this section
- Installation and setup: install the package, create the
LicenseManager, and every option. - Activating a license: the activation screen,
setLicenseKeyand its errors. - License states: what each state means and what your app should show.
- Validation and renewal: when the SDK validates, what it sends, and how to tune it.
- Working offline: the fallback on the stored token, retries and versions.
- Clock tampering: how a clock set back is detected.
- Machine fingerprint: how the device is identified, and how to override it.
- Stored data: what’s stored, where, and how to reset it.
- Renderer and IPC: expose the license to your windows.
- API reference: every method, option and type.
Build your integration against a test product first: its keys start with TEST-, and nothing you do there touches your real customers. See development and release builds.