Node.js SDK
The Node.js 18+ SDK is @dycrypt/license. It includes ESM, CommonJS, and TypeScript declarations with no runtime dependencies.
Install
Section titled “Install”Until the package is published to the public npm registry, install it from the DYCRYPT SDK checkout:
npm install /path/to/dycrypt/sdk/nodeA single-file ESM version is also available as sdk/node/src/dycrypt-license.mjs.
Print a machine fingerprint
Section titled “Print a machine fingerprint”import { fingerprint } from '@dycrypt/license';
if (process.argv.includes('--fingerprint')) { console.log(fingerprint()); process.exit(0);}Use this before issuing a Full Offline or offline-activated Hybrid licence.
Configure one verifier
Section titled “Configure one verifier”import { LicenseVerifier, Policy } from '@dycrypt/license';import { readFileSync } from 'node:fs';
const verifier = new LicenseVerifier({ publicKey: readFileSync('product-public-key.pem', 'utf8'), productKey: 'your-product-key', issuerUrl: 'https://app.dycrypt.com', orgSlug: 'your-org-slug', policy: Policy.ADVISORY, timeoutMs: 5_000,});Omit issuerUrl, orgSlug, and policy for Full Offline. Build the verifier once and reuse it.
Full Offline
Section titled “Full Offline”const result = verifier.verify(readFileSync('customer.lic', 'utf8'));enforce(result);verify() is synchronous, never touches the network, and returns INVALID for malformed input, a wrong product, an unsupported schema, or a machine mismatch.
Full Online and Hybrid
Section titled “Full Online and Hybrid”const result = await verifier.check( readFileSync('customer.lic', 'utf8'),);enforce(result);Call check() at startup and schedule later calls at the product’s signed interval. The SDK starts no timer. Keep the verifier for the process lifetime so it retains successful-check state and cached results.
Handle every status
Section titled “Handle every status”import { Status } from '@dycrypt/license';
function enforce(result) { switch (result.status) { case Status.ACTIVE: return; case Status.GRACE: console.warn('Licence is inside its expiry grace period'); return; case Status.STALE: throw new Error('Reconnect to refresh the licence status'); case Status.PENDING: throw new Error(`Licence starts at ${result.startsAt}`); case Status.REVOKED: case Status.EXPIRED: case Status.INVALID: case Status.UNKNOWN: throw new Error(`Unlicensed (${result.status}): ${result.reason}`); }}ACTIVE and GRACE are the only statuses with valid === true.
Read product claims
Section titled “Read product claims”const maxUsers = result.getInt('maxUsers', 5);const edition = result.getString('edition', 'standard');const exportEnabled = result.getBool('exportEnabled', false);const features = result.getStringList('features', []);Use result.checkedOnline to distinguish a real issuer answer from a local fallback and result.onlineError to log why an online request did not complete.