Skip to content

Bensonheimer992/LicenseGate-JS-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Gate Wrapper

Installation

To install LicenseGate Wrapper, simply run the following command:

For npm:

npm install licensegate

Dependencies

  • Axios
  • Node.js v20.11.10 or higher

Usage

//index.js
const LicenseGate = require('licensegate').default;
const { ValidationType } = require('licensegate');

async function checkLicense() {
  const userId = 'Your UserID';
  const licenseKey = 'Your LicenseKey';

  const licenseGate = new LicenseGate(userId);

  const result = await licenseGate.verify(licenseKey);

  if (result === ValidationType.VALID) {
    console.log('The Key is Valid.');
  } else {
    console.log(`The Key is invalid. Reason: ${result}`);
  }
}

checkLicense().catch(console.error);

With Custom Server URL

//index.js
const LicenseGate = require('licensegate').default;
const { ValidationType } = require('licensegate');

async function checkLicense() {
  const userId = 'Your UserID';
  const licenseKey = 'Your LicenseKey';
  const serverUrl = 'https://mybackendserver.com';

  const licenseGate = new LicenseGate(userId).setValidationServer(serverUrl);

  const result = await licenseGate.verify(licenseKey);

  if (result === ValidationType.VALID) {
    console.log('The Key is Valid.');
  } else {
    console.log(`The Key is invalid. Reason: ${result}`);
  }
}

checkLicense().catch(console.error);

With Public Rsa Key

//index.js
const LicenseGate = require('licensegate').default;
const { ValidationType } = require('licensegate');

async function checkLicense() {
  const userId = 'Your UserID';
  const licenseKey = 'Your LicenseKey';
  const publicRSAKey = 'Your RSA Key';

  const licenseGate = new LicenseGate(userId).setPublicRsaKey(publicRSAKey).useChallenges(true);

  const result = await licenseGate.verify(licenseKey);

  if (result === ValidationType.VALID) {
    console.log('The Key is Valid.');
  } else {
    console.log(`The Key is invalid. Reason: ${result}`);
  }
}

checkLicense().catch(console.error);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published