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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wibus-studio/keygen-node

v0.0.4

Published

Node.js SDK for Keygen.sh. Specially customized for private use.

Readme

Keygen Node.js SDK

Node.js SDK for Keygen.sh. Specially customized for private use.

Motivation

The Keygen.sh platform does not provide any usable SDK, with only an official keygen-go and an unofficial keygen-rust. Neither of these SDKs align with my technology stack, so I had to write my own...

Additionally, these SDKs are merely implementations of the API Reference, requiring users to implement all the necessary details themselves. I need a convenient SDK that can easily handle product activation/validation/deactivation processes... and to achieve this, we need to create our own library...

There are many customizations that I have made to the SDK, so it is not suitable for public use.

Features

  • [x] License Validation
  • [x] Machine Activation
  • [x] Machine Deactivation
  • [x] Get System Information

Usage

pnpm install @wibus-studio/keygen-node

Basic Usage

If you are inside my studio, you can use the following code to initialize the client:

Initialize Client

import { KeygenClient } from "@wibus-studio/keygen-node";

const client = new KeygenClient({
  accountId: "YOUR_ACCOUNT_ID",
  productId: "YOUR_PRODUCT_ID",
  // Optional configuration
  baseUrl: "https://api.keygen.sh/v1",
  // Whether to require fingerprint validation
  requireFingerprintValidation: true,
  // System identifier configuration
  systemIdentifier: {
    includeFingerprint: true,
    includePlatform: true,
    includeHostname: true,
    includeIp: true,
    includeCores: true,
    metadata: {
      // Custom metadata
    },
  },
});

License Validation

[!IMPORTANT] You need to check the validity of the license yourself. For more information, please refer to the API Reference.

// Basic validation
const validation = await client.validateLicense("LICENSE_KEY");
if (validation.meta.valid) {
  // ⚠️ You need to check the validity of the license yourself!!!
  console.log("License is valid");
  console.log("License details:", validation.data);
} else {
  console.log("License is invalid:", validation.meta.detail);
}

// Validation with system information
const validationWithSystem =
  await client.validateLicenseWithSystem("LICENSE_KEY");

Machine Activation

// Activate machine
const activation = await client.activateMachine("LICENSE_ID", "LICENSE_KEY");
console.log("Machine activated:", activation.data);

// Deactivate machine
await client.deactivateMachine("MACHINE_ID", "LICENSE_KEY");

Error Handling

All errors are thrown as Error objects.

We provide a ApiError type to help you handle errors. It's following the API Reference.

import type { ApiError } from "@wibus-studio/keygen-node";

API Reference

KeygenClient Configuration Options

interface KeygenConfig {
  // Required parameters
  accountId: string; // Keygen account ID
  productId: string; // Product ID

  // Optional parameters
  baseUrl?: string; // API base URL
  version?: string; // API version
  requireFingerprintValidation?: boolean; // Whether to require fingerprint validation
  systemIdentifier?: SystemIdentifierConfig; // System identifier configuration
}

interface SystemIdentifierConfig {
  includeFingerprint?: boolean; // Whether to include fingerprint
  includePlatform?: boolean; // Whether to include platform information
  includeHostname?: boolean; // Whether to include hostname
  includeIp?: boolean; // Whether to include IP
  includeCores?: boolean; // Whether to include CPU cores
  metadata?: Record<string, any>; // Custom metadata
}

License Status

License may have the following statuses:

enum LicenseStatus {
  ACTIVE = "ACTIVE", // Active
  INACTIVE = "INACTIVE", // Inactive
  EXPIRING = "EXPIRING", // Expiring
  EXPIRED = "EXPIRED", // Expired
  SUSPENDED = "SUSPENDED", // Suspended
  BANNED = "BANNED", // Banned
}

Validation Status

Validation response will contain one of the following statuses:

enum LicenseValidationStatus {
  VALID = "VALID", // Valid
  SUSPENDED = "SUSPENDED", // Suspended
  EXPIRED = "EXPIRED", // Expired
  OVERDUE = "OVERDUE", // Overdue
  NOT_FOUND = "NOT_FOUND", // Not found
  NO_MACHINE = "NO_MACHINE", // No machine
  NO_MACHINES = "NO_MACHINES", // No machine group
  TOO_MANY_MACHINES = "TOO_MANY_MACHINES", // Too many machines
  // ... More statuses please refer to type definition
}

References

Author

Keygen Node.js SDK © Wibus. Created on Jan 19, 2025. All rights reserved.

Personal Website · Blog · GitHub @wibus-wee · Telegram @wibus✪