Electron main processes
Validate from the Node.js side of a desktop app before unlocking paid behavior.
Node.js software licensing
Add product-scoped license checks to Electron main processes, Node.js command-line tools, and paid developer utilities with the GrebKey Node SDK. The SDK supplies a machine fingerprint, local validation cache, and configurable offline grace.
Validate from the Node.js side of a desktop app before unlocking paid behavior.
Check a product-scoped key before running paid commands or workflows.
Use the same SDK path in Node.js utilities, local services, and plugin hosts.
This public quickstart covers environment configuration, SDK validation, and the valid plus machine-activated decision. Save it as first-validation.mjs, provide the three environment variables, and run it where you installed grebkey.
npm install grebkey
import { GrebKeyClient } from "grebkey";
const apiUrl = process.env.GREBKEY_API_URL;
const productId = process.env.GREBKEY_PRODUCT_ID;
const licenseKey = process.env.GREBKEY_LICENSE_KEY;
if (apiUrl == null || productId == null || licenseKey == null) {
console.error("Set GREBKEY_API_URL, GREBKEY_PRODUCT_ID, and GREBKEY_LICENSE_KEY.");
process.exitCode = 1;
} else {
const client = new GrebKeyClient({ apiUrl, productId });
try {
const result = await client.validate(licenseKey);
if (result.valid !== true || result.machine_activated !== true) {
console.error(`Not licensed: ${result.reason ?? "machine_not_activated"}`);
process.exitCode = 1;
} else {
console.log("Licensed!");
}
} catch {
console.error("License validation could not be completed.");
process.exitCode = 1;
}
}
node first-validation.mjs