@chris-si/electron-gumroad-license
TypeScript icon, indicating that this package has built-in type declarations

1.1.16 • Public • Published

Electron Gumroad License

NPM Package

This library allows you to verify and store a user's license for your Electron app with Gumroad's API.

A valid license is automatically stored in a local file that's encrypted with a key unique to the user's computer. While this doesn't prevent cracking a license, it makes it more difficult to copy a license file to another computer.

Getting Started

To use this library, create a new licenseManager with the ID of your Gumroad product. You can then use it to check the current license, validate a new one, and more:

import { createLicenseManager } from "electron-gumroad-license-2";

const licenseManager = createLicenseManager("product-id");

// Verify a license key and store it if it's valid
await licenseManager.addLicense("license-key");

// Check whether a local license exists and if it's valid
await licenseManager.checkCurrentLicense();

Options

In addition to the product ID, you can pass an option object to the licenseManager. The following values can be set:

const options = {
  /** Specifies how many times a single license code can be activated. Default: unlimited. */
  maxUses: number;
  /** Specifies how many days a license stays valid without being validated. Default: unlimited. */
  maxDaysBetweenChecks: number;
  /** Overrides Gumroad's default API endpoint for verifying licenses. */
  gumroadApiUrl: string;
  /** Disables encrypting the license key with a unique machine id. */
  disableEncryption: boolean;
}

Contributing

This package is still in its early stages. Please feel free to contribute by opening issues and submitting PRs if you feel that something could be done better.

Readme

Keywords

none

Package Sidebar

Install

npm i @chris-si/electron-gumroad-license

Weekly Downloads

1

Version

1.1.16

License

MIT

Unpacked Size

24 kB

Total Files

7

Last publish

Collaborators

  • chris-si