Node.js SDK

Official SDKs

Node.js SDK

TypeScript-first. Works in a Node.js runtime with native fetch (Node.js 18+; use a supported LTS release). Uses the native fetch API — no dependencies.

Installation

npm
npm install @permitcore/permitcore

Quick start

TypeScript
import { PermitCoreClient } from '@permitcore/permitcore';

const client = new PermitCoreClient('https://api.permitcore.dev');
const result = await client.validate('PERMIT-XXXX-XXXX-XXXX-XXXX');

if (!result.isValid) {
  console.error(`License invalid: ${result.message}`);
  process.exit(1);
}

// Feature flags
const features = new Set(result.features ?? []);
if (features.has('export')) enableExport();
if (features.has('api'))    enableApiAccess();

// Or use the static helper:
if (PermitCoreClient.hasFeature(result, 'export')) enableExport();

Activation

TypeScript
// Auto-collects HWID when deviceId is omitted
const result = await client.activate(
    'PERMIT-XXXX-XXXX-XXXX-XXXX',
    PermitCoreClient.getHardwareId(), // optional — auto-used if omitted
    'My workstation'                      // optional display name
);

Floating licenses

Check out a seat when the session starts. While running, heartbeat about every four minutes and handle failed heartbeats. Stop using a rejected session. Cancel the heartbeat loop and await checkin during normal shutdown; process-exit callbacks may not finish network calls. See floating-session lifecycle.

Hardware ID

TypeScript
import { PermitCoreClient } from '@permitcore/permitcore';

const hwid = PermitCoreClient.getHardwareId();
// "a3f82c91b44e..." — stable SHA-256 of machine identifiers