npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

intgate

v1.0.3

Published

Node.js client library for the IntGate license verification API

Readme

IntGate Node.js/TypeScript Client Library

Node.js and TypeScript client library for the IntGate license verification API.

Installation

npm install intgate

Or with yarn:

yarn add intgate

Quick Start

TypeScript

import { IntGateClient } from 'intgate';

// Initialize the client with your team ID
const client = new IntGateClient('your-team-uuid-here');

// Verify a license
async function verifyLicense() {
  try {
    const result = await client.verifyLicense({
      licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',
      hardwareIdentifier: 'unique-device-id',
      version: '1.0.0'
    });
    
    if (result.result.valid) {
      console.log('License is valid!');
      console.log('License data:', result.data);
    } else {
      console.log('License invalid:', result.result.details);
    }
  } catch (error) {
    console.error('Error:', error);
  }
}

verifyLicense();

JavaScript

const { IntGateClient } = require('intgate');

// Initialize the client with your team ID
const client = new IntGateClient('your-team-uuid-here');

// Verify a license
async function verifyLicense() {
  try {
    const result = await client.verifyLicense({
      licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',
      hardwareIdentifier: 'unique-device-id',
      version: '1.0.0'
    });
    
    if (result.result.valid) {
      console.log('License is valid!');
    }
  } catch (error) {
    console.error('Error:', error);
  }
}

API Reference

Initialize Client

import { IntGateClient } from 'intgate';

const client = new IntGateClient(
  'your-team-uuid',  // Required: Your team's UUID from IntGate dashboard
  'https://license.intserver.com/api/v1'  // Optional: Custom API base URL
);

Note: Configure which fields are returned during license verification by navigating to: Dashboard → Team → Settings → Returned Fields (https://license.intserver.com/dashboard/team/settings?tab=security)

If no fields are configured, the data object will be empty but the library will handle this gracefully.

Verify License

Validates a license key and returns license information, customer data, and product details.

const result = await client.verifyLicense({
  licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',  // Required
  customerId: 'customer-uuid',  // Optional: Required if strict customers enabled
  productId: 'product-uuid',  // Optional: Required if strict products enabled
  challenge: 'random-string',  // Optional: For request signing
  version: '1.0.0',  // Optional: Software version (3-255 chars)
  hardwareIdentifier: 'device-id',  // Optional: Unique device ID (10-1000 chars)
  branch: 'main'  // Optional: Product branch (2-255 chars)
});

License Heartbeat

Send periodic heartbeats to determine if a device is still active.

const result = await client.licenseHeartbeat({
  licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',  // Required
  hardwareIdentifier: 'device-id',  // Required: Unique device ID (10-1000 chars)
  customerId: 'customer-uuid',  // Optional
  productId: 'product-uuid',  // Optional
  challenge: 'random-string',  // Optional
  version: '1.0.0',  // Optional: Software version (3-255 chars)
  branch: 'main'  // Optional: Product branch (2-255 chars)
});

Download Release

Download an encrypted release file.

const encryptedFile = await client.downloadRelease({
  licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',  // Required
  productId: 'product-uuid',  // Required
  sessionKey: 'encrypted-session-key',  // Required: Encrypted with team's public key
  hardwareIdentifier: 'device-id',  // Required: Unique device ID
  version: '1.0.0',  // Required: Software version
  customerId: 'customer-uuid',  // Optional
  branch: 'main'  // Optional: Product branch
});

// Save to file:
import fs from 'fs';
fs.writeFileSync('release.encrypted', encryptedFile);

Automatic Heartbeat

Start automatic heartbeat in the background with event-based notifications.

import { IntGateClient } from 'intgate';

const client = new IntGateClient('your-team-uuid');

// Listen for heartbeat events
client.on('heartbeat', (result) => {
    console.log(`✓ Heartbeat OK at ${result.result.timestamp}`);
    console.log(`  License valid: ${result.result.valid}`);
});

client.on('heartbeat-error', (error) => {
    console.error('✗ Heartbeat failed:', error);
});

// Start automatic heartbeat (runs with setTimeout)
client.startAutomaticHeartbeat(
    {
        licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',
        hardwareIdentifier: 'device-12345',
        version: '1.0.0'
    },
    1800  // 30 minutes in seconds
);

console.log('Application running with automatic heartbeat...');

// Get last heartbeat result anytime
const lastResult = client.getLastHeartbeatResult();
if (lastResult?.result.valid) {
    console.log('License is active');
}

// Check if heartbeat is running
if (client.isHeartbeatRunning()) {
    console.log('Automatic heartbeat is active');
}

// Stop when done
client.stopAutomaticHeartbeat();

Error Handling

The library provides specific exception types:

import { 
  IntGateClient, 
  IntGateAPIError, 
  IntGateValidationError 
} from 'intgate';

const client = new IntGateClient('your-team-uuid');

try {
  const result = await client.verifyLicense({
    licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'
  });
} catch (error) {
  if (error instanceof IntGateValidationError) {
    // Input validation failed
    console.error('Validation error:', error.message);
  } else if (error instanceof IntGateAPIError) {
    // API request failed
    console.error('API error:', error.message);
    console.error('Status code:', error.statusCode);
    console.error('Response data:', error.responseData);
  } else {
    // Other errors
    console.error('Unexpected error:', error);
  }
}

Complete Example

import { IntGateClient, IntGateAPIError } from 'intgate';

// Initialize client
const client = new IntGateClient('your-team-uuid-here');

async function main() {
  try {
    // Verify license on startup
    console.log('Verifying license...');
    const result = await client.verifyLicense({
      licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',
      hardwareIdentifier: 'my-device-12345',
      version: '1.0.0',
      productId: 'your-product-uuid'
    });
    
    if (!result.result.valid) {
      console.error('License validation failed:', result.result.details);
      process.exit(1);
    }
    
    console.log('License verified successfully!');
    console.log('Expires:', result.data.license.expirationDate || 'Never');
    
    // Setup automatic heartbeat with event listeners
    console.log('\nStarting automatic heartbeat...');
    
    client.on('heartbeat', (result) => {
      console.log('Heartbeat successful');
    });
    
    client.on('heartbeat-error', (error) => {
      console.error('Heartbeat failed:', error);
    });
    
    client.startAutomaticHeartbeat(
      {
        licenseKey: 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX',
        hardwareIdentifier: 'my-device-12345',
        version: '1.0.0'
      },
      1800  // Every 30 minutes in seconds
    );
    
    console.log('Application running...');
    
  } catch (error) {
    if (error instanceof IntGateAPIError) {
      console.error('API Error:', error.message);
      if (error.statusCode === 404) {
        console.error('License not found');
      } else if (error.statusCode === 401) {
        console.error('Unauthorized - check your team ID');
      }
      process.exit(1);
    }
    throw error;
  }
}

main();

TypeScript Support

This library is written in TypeScript and includes full type definitions:

import { 
  IntGateClient,
  VerifyLicenseOptions,
  VerifyLicenseResponse,
  LicenseHeartbeatOptions,
  HeartbeatResponse,
  DownloadReleaseOptions,
  License,
  Customer,
  Product,
  VerificationResult
} from 'intgate';

Build from Source

# Install dependencies
npm install

# Build TypeScript to JavaScript
npm run build

# The built files will be in the dist/ directory

License

MIT License

Support

For API documentation, visit: https://license.intserver.com

For examples, see: AUTOMATIC_HEARTBEAT.md