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

@softactivate/licensing-core

v5.0.3

Published

SoftActivate Licensing SDK - Core library for Browser and Node.js

Readme

@softactivate/licensing-core

WebAssembly build of the SoftActivate Licensing SDK for Browser and Node.js environments.

Features

  • 🚀 Cross-platform - Works in browsers and Node.js
  • 📦 Dual-build - ESM and CommonJS support
  • 🔒 License Key Generation - Create cryptographically secure license keys
  • License Key Validation - Validate keys without network calls
  • 🔑 ECC Signatures - Uses elliptic curve cryptography
  • 📄 Template Serialization - Save/load templates as XML or JSON

Installation

npm install @softactivate/licensing-core

Quick Start

Node.js (ESM)

import createLicensing from '@softactivate/licensing-core';

async function main() {
    // Initialize the WASM module
    const licensing = await createLicensing();
    
    const {
        SDK,
        LicenseTemplate,
        KeyGenerator,
        KeyValidator,
        FIELD_TYPE_INTEGER,
        FIELD_TYPE_STRING
    } = licensing;

    // =========================================================
    // KEY GENERATION (server-side only, requires SDK license)
    // =========================================================
    
    // Set SDK license key (required for generating key pairs and license keys)
    // ⚠️ NEVER include this in customer-facing software!
    SDK.setLicenseKey('YOUR-SDK-LICENSE-KEY');

    // Create a license template
    const template = new LicenseTemplate();
    template.setNumberOfGroups(6);
    template.setCharactersPerGroup(5);
    template.setSignatureSize(110);
    template.setDataSize(40);
    
    // Generate signing key pair
    template.generateSigningKeyPair();
    
    // Add data fields
    template.addDataField('UserID', FIELD_TYPE_INTEGER, 16, 0);
    template.addDataField('Edition', FIELD_TYPE_STRING, 24, 16);

    // Save template with private key (keep secure on server)
    const privateTemplate = template.saveJson(true);
    
    // Save public certificate (safe to embed in customer software)
    const publicCert = template.getPublicKeyCertificate();

    // Generate a license key
    const generator = new KeyGenerator();
    generator.setLicenseTemplate(template);
    generator.setIntKeyData('UserID', 12345);
    generator.setStringKeyData('Edition', 'PRO');
    
    const licenseKey = generator.generateKey();
    console.log('Generated key:', licenseKey);

    generator.destroy();
    template.destroy();
    
    // =========================================================
    // KEY VALIDATION (client-side, no SDK license needed)
    // =========================================================
    
    // Create template with public certificate only
    const clientTemplate = new LicenseTemplate();
    clientTemplate.setPublicKeyCertificate(publicCert);
    clientTemplate.setNumberOfGroups(6);
    clientTemplate.setCharactersPerGroup(5);
    clientTemplate.addDataField('UserID', FIELD_TYPE_INTEGER, 16, 0);
    clientTemplate.addDataField('Edition', FIELD_TYPE_STRING, 24, 16);

    // Validate the license key
    const validator = new KeyValidator();
    validator.setLicenseTemplate(clientTemplate);
    validator.setKey(licenseKey);

    if (validator.isKeyValid()) {
        console.log('Valid! UserID:', validator.queryIntKeyData('UserID'));
        console.log('Edition:', validator.queryStringKeyData('Edition'));
    }

    // Cleanup
    validator.destroy();
    clientTemplate.destroy();
}

main();

Node.js (CommonJS)

const createLicensing = require('@softactivate/licensing-core');

async function main() {
    const licensing = await createLicensing();
    // ... same as above
}

main();

Browser

<script type="module">
import createLicensing from '@softactivate/licensing-core';

async function main() {
    const licensing = await createLicensing();
    // ... same as above
}

main();
</script>

Or with a bundler (webpack, rollup, vite, etc.):

import createLicensing from '@softactivate/licensing-core';

// Client-side validation - no SDK license key needed!
async function validateLicenseKey(key, publicCertificate) {
    const licensing = await createLicensing();
    
    const template = new licensing.LicenseTemplate();
    template.setPublicKeyCertificate(publicCertificate);
    // ... configure template
    
    const validator = new licensing.KeyValidator();
    validator.setLicenseTemplate(template);
    validator.setKey(key);
    
    return validator.isKeyValid();
}

API Reference

Initialization

createLicensing()

Initialize the WASM module and return the licensing API. This is an async function that must be awaited.

import createLicensing from '@softactivate/licensing-core';

const licensing = await createLicensing();

The returned licensing object contains all classes and constants:

  • SDK - SDK registration
  • LicenseTemplate - License key template configuration
  • KeyGenerator - License key generation
  • KeyValidator - License key validation
  • LicensingClient - Online activation client
  • License - License data container
  • LicenseValidationArgs - Validation arguments
  • LicenseValidationResult - Validation result
  • Constants: FIELD_TYPE_*, ENCODING_*, STATUS_*

SDK

SDK.setLicenseKey(key)

Set the SDK license key. Required only for generating key pairs and license keys (server-side operations).

⚠️ WARNING: Never include the SDK license key in customer-facing software. It is only needed for:

  • template.generateSigningKeyPair()
  • generator.generateKey()

License key validation only requires the public certificate and does not need the SDK license key.

// Server-side only!
SDK.setLicenseKey('XXXXX-XXXXX-XXXXX-XXXXX-XXXXX');

SDK.isRegistered()

Check if the SDK is registered.

const isRegistered = SDK.isRegistered();

LicenseTemplate

The LicenseTemplate class defines the structure and format of license keys.

const template = new LicenseTemplate();

// Key format
template.setNumberOfGroups(6);        // e.g., XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
template.setCharactersPerGroup(5);
template.setGroupSeparator('-');
template.setEncoding(ENCODING_BASE32X);

// Cryptographic parameters
template.setSignatureSize(110);       // Signature bits
template.setDataSize(40);             // Data bits

// Generate or set keys
template.generateSigningKeyPair();
// or
template.setPublicKeyCertificate(certBase64);
template.setPrivateKey(keyBase64);

// Define data fields
template.addDataField('FieldName', FIELD_TYPE_INTEGER, bitSize, offset);

// Serialization
const xml = template.saveXml(true);   // Include private key
const json = template.saveJson(false); // Public only

// Cleanup
template.destroy();

KeyGenerator

Generate license keys from a template.

const generator = new KeyGenerator();
generator.setLicenseTemplate(template);

// Set key data
generator.setIntKeyData('UserID', 12345);
generator.setStringKeyData('Name', 'ABC');
generator.setDateKeyData('Expiry', 2026, 12, 31);

// Generate key
const key = generator.generateKey();

generator.destroy();

KeyValidator

Validate license keys and extract embedded data.

const validator = new KeyValidator();
validator.setLicenseTemplate(template);
validator.setKey(licenseKey);

if (validator.isKeyValid()) {
    const userId = validator.queryIntKeyData('UserID');
    const name = validator.queryStringKeyData('Name');
    const { year, month, day } = validator.queryDateKeyData('Expiry');
}

validator.destroy();

Constants

Field Types

  • FIELD_TYPE_RAW (0) - Raw binary data
  • FIELD_TYPE_INTEGER (1) - Integer value
  • FIELD_TYPE_STRING (2) - String value
  • FIELD_TYPE_DATE14 (3) - Date (14-bit format)
  • FIELD_TYPE_DATE16 (4) - Date (16-bit format)
  • FIELD_TYPE_DATE13 (5) - Date (13-bit format)

Encoding Types

  • ENCODING_BASE32X (5) - Base32 encoding (default)
  • ENCODING_BASE64X (6) - Base64 encoding

Status Codes

  • STATUS_SUCCESS (0)
  • STATUS_GENERIC_ERROR (1)
  • STATUS_INVALID_LICENSE_KEY (6)
  • ... and more

Building from Source

Prerequisites

Build Steps

  1. Install Emscripten SDK:

    git clone https://github.com/emscripten-core/emsdk.git
    cd emsdk
    ./emsdk install latest
    ./emsdk activate latest
  2. Build the WASM module:

    cd src/server/licensing-core
       
    # Unix/Git Bash
    EMSDK_PATH=/path/to/emsdk ./scripts/build.sh
  3. The output files will be in the project root:

    • index.js - ESM module
    • index.cjs - CommonJS module
    • index.d.ts - TypeScript definitions

Browser Compatibility

  • Chrome 57+
  • Firefox 52+
  • Safari 11+
  • Edge 16+

Node.js Compatibility

  • Node.js 14+

License

See LICENSE file.

Support

For support, visit https://www.softactivate.com or contact [email protected].