License key validation for desktop and downloadable software

Buyers get a license key by email. Your app activates it once per device and checks it on every start. Signed responses keep the app working offline for a grace period.

How it works

  1. You enable license keys on your Monemee product and choose a device limit, a duration (optional) and a plan name (optional).
  2. After each purchase Monemee generates a key such as MM-A7K2-9FQ3-XT8M-2B4C and emails it to the buyer.
  3. Your app calls activate(key) once. The key is bound to the device.
  4. On every start your app calls check(). Monemee answers with a signed response that the SDK verifies and stores.
  5. Without a connection the last valid response counts for graceDays (default: 7).

JavaScript: Electron, Tauri, browser extensions, Node CLIs

npm install monemee-client
import { createLicense } from 'monemee-client';

const license = createLicense({ productId: 123, graceDays: 7 });

const result = await license.activate(keyFromUser);
if (!result.valid) console.log(result.reason);    // e.g. 'activation_limit'

const { valid, plan, offline } = await license.check();

In Electron, run the license code in the main process and expose it to the renderer through a preload script. In Chrome extensions, pass chrome.storage as storage. Both are shown in the examples.

Step-by-step guides: Electron, Tauri and Chrome extensions.

Python

pip install "monemee[offline]"
from monemee import License

lic = License(product_id=123)
lic.activate("MM-XXXX-XXXX-XXXX-XXXX")   # once
if lic.check().valid:                     # on every start
    run_pro()

Full walkthrough with a command-line interface: Python license key guide.

Offline license verification

Every response from /licenses/validate and /licenses/activate includes a signed object. The signature is Ed25519 over the exact payload string, which contains a SHA-256 hash of the key, the product, the device, the plan, the expiry date and the issue time. The SDK accepts a stored response offline only if:

The public keys are bundled with the SDKs and published at https://monemee.com/.well-known/monemee-license-keys.json.

Reasons a key is not valid

reason Meaning
not_found The key does not exist for this product
revoked Revoked, for example after a refund
expired The license duration has ended
activation_limit The device limit is reached; the buyer can free a device with deactivate()
device_not_activated The key is valid but not activated on this device
offline No connection and no valid stored response
not_activated No key is stored on this device yet: call activate() first (also after deactivate() or a revoked key)
invalid_signature The online answer carries a signature that does not verify, for example a tampered response from a proxy. Not returned when the runtime cannot verify Ed25519 at all; then the online answer counts, without offline grace

Testing

The dashboard issues test keys under License keys > Test key. They are valid for 30 days, behave like real keys and are marked with test: true. More in Test the purchase flow without paying.

Last updated: