Start free trial

Electron app licensing: an SDK for license keys that work offline

@carchalabs/seal-electron is the Carcha Seal SDK for the Electron main process and Node.js. It activates a license key once, validates a signed lease on the computer at every start, with or without a network, and tells your app which features the customer paid for. A native module, @carchalabs/seal-hwid, reads the hardware and verifies leases a second time.

Reading time
3 min
Updated
11 November 2026
Sections
5
On this page
Install and requirementsCheck at every start, activate onceMethodsWhat the SDK checksWhat it does not do

Install and requirements

npm install @carchalabs/seal-electron
Package@carchalabs/seal-electron on npm
Runs inThe Electron main process, or Node.js 22.13 or later
Native module@carchalabs/seal-hwid, installed with the SDK; keep it out of the bundler
Stored licenselicense.dat, encrypted through secureStore (Electron safeStorage)

Check at every start, activate once

Your server address, product code and public keys (the current and the next, so the signing key can rotate without an app update) are on the console's Integrate page.

const { Seal } = require('@carchalabs/seal-electron');

const seal = new Seal({
  serverUrl: 'https://licenses.example.com',
  product: 'example-studio',
  publicKey: [currentKeyPem, nextKeyPem],
  storageDir: app.getPath('userData'),
  appVersion: app.getVersion(),
  secureStore: {
    encrypt: (s) => safeStorage.encryptString(s),
    decrypt: (b) => safeStorage.decryptString(b),
    isProtected: () => process.platform !== 'linux' || safeStorage.getSelectedStorageBackend() !== 'basic_text',
  },
});
let state = await seal.check();                 // at every start; offline from the saved lease
if (state.status === 'unlicensed') state = await seal.activate(keyTheUserTyped);
if (Seal.hasFeature(state, 'export-pdf')) exportPdf();

Activating binds the license to this computer and stores a lease signed with Ed25519. check works from that lease when the network is down; by default the app checks in every 72 hours and keeps working 7 more days without the server.

Methods

activate(key, machineName?)Takes a seat, stores the lease. machineName is what the console shows.
check()Checks in and stores the new lease; offline, decides from the stored one. At start and every few hours.
deactivate()Frees the seat and deletes the lease.
offlineRequest(key, machineName?)Offline step 1: the request file (JSON) for a computer with no network. Hashes only, never raw serials.
activateOffline(file)Offline step 2: verifies and saves the license file.
deactivateOffline()Removes the license, returns the deactivation file.
checkout(key?, options?)Floating licenses: takes a seat while the app runs; the seat renews itself and emits lost when it cannot be kept.
decrypt(feature, data)Opens data encrypted for a feature, offline.
requireEncrypted(feature, file)Loads an encrypted CommonJS module from memory and returns its exports.
Seal.hasFeature(state, feature)True only for valid and grace states that include the feature.

Errors are a LicenseError with a code. The Electron guide walks through the main-process code, the renderer and moving to a new computer. Full reference: documentation.

What the SDK checks

  • The signature. The lease is a compact JWS signed with Ed25519; the app holds only public keys, chosen by key id.
  • The computer. The lease names a hash of the operating system's machine ID and the product code; the raw ID never leaves the computer.
  • Time. Expiry, the end of updates, the check-in deadline and grace; a clock turned back by more than a day is reported as clock_suspect.
  • Features. Only features listed in the lease are granted, and data encrypted for a feature opens only with a lease that includes it.

For a floating license the app takes a seat instead of activating a computer: seal.checkout() returns a seat that renews itself and is given back on quit.

What it does not do

  • Stop someone who controls the computer. A check in your code can be patched out. Code or data encrypted for a feature, opened with decrypt, is what a patched app is missing.
  • Revoke an offline app at once. A computer that stays offline learns of a revoked license at its next check-in, after grace.
  • Floating seats without a connection. A floating seat needs your server while the app runs; a license server at the customer's site is not in version 1.

Sources

Checked on 11 November 2026 against the published SDKs and the documentation.

License your app in an afternoon.

14-day trial, no card. Your own server address and signing key from the first minute.