New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lefe-dev/lefe-verify-license

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lefe-dev/lefe-verify-license

Verify lefe license

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
766
increased by57.94%
Maintainers
0
Weekly downloads
 
Created
Source

@lefe-dev/lefe-verify-license

A library to verify license keys, display watermarks for trial versions, and manage license information for the Lefe platform.

Installation

Install via npm:

npm install @lefe-dev/lefe-verify-license

Usage

License Verification

import { LicenseVerifier } from "@lefe-dev/lefe-verify-license";

const licenseVerifier = new LicenseVerifier({
  scopes: [{ name: "your-package-name" }],
  organization: "your-organization-name",
});

const result = licenseVerifier.verifyLicense({
  licenseKey: "customer-license-key",
  packageScope: "your-package-name",
});

console.log(result.status);

Watermark Display

import { showWatermark } from "@lefe-dev/lefe-verify-license";

showWatermark(result.status, "block", {
  parent: document.body,
  width: 100,
  height: 100,
});

License Management

import { LicenseInfo } from "@lefe-dev/lefe-verify-license";

const licenseInfo = new LicenseInfo({
  organization: "your-organization-name",
});

licenseInfo.setLicenseKey("customer-license-key");
const key = licenseInfo.getLicenseKey();

API

LicenseVerifier

  • constructor({ scopes, organization })

    • scopes: ScopesTree - A tree structure defining the scopes of licenses.
    • organization: Organization - The name of the organization managing the license.

    Example:

    const licenseVerifier = new LicenseVerifier({
      scopes: [
        { name: "pro", children: [{ name: "package-one" }] },
        {
          name: "premium",
          children: [{ name: "package-two" }, { name: "package-three" }],
        },
      ],
      organization: "your-org-name",
    });
    
  • verifyLicense({ licenseKey, packageScope })

    • licenseKey: string - The license key to be verified.
    • packageScope: ScopeName - The scope of the package being verified.

    Returns: { status: LicenseStatus; meta?: object }

    • status: LicenseStatus - The result of the license verification NotFound, Invalid, ExpiredSubscription, ExpiredSubscriptionGrace, Valid, OutOfScope
    • meta: object (optional) - Additional metadata about the license verification result.

    Example:

    licenseVerifier.verifyLicense({
      licenseKey: "customer-license-key",
      packageScope: "pro",
    });
    

showWatermark

  • showWatermark(status, type, options)

    • status: LicenseStatus - The license status to check.
    • type: string - Type of watermark.
      • Possible values: 'image', 'block'
    • options: WatermarkOptions | ImageWatermarkOptions - Options for watermark customization.
      • parent: HTMLElement - The parent element to attach the watermark.
      • width: number - The width of the watermark.
      • height: number - The height of the watermark.
      • backgroundRepeat: string (optional) - Controls the repetition of the watermark background.
      • rotate: number (optional) - Rotation angle of the watermark.

    Check watermark-js-plus package for more info.

LicenseInfo

  • constructor({ organization })

    • organization: Organization - The name of the organization for which the license is managed.

    Example:

    const licenseInfo = new LicenseInfo({
      organization: "your-organization-name",
    });
    
  • getLicenseKey()

    • Returns: License["key"] - The current license key.

    Example:

    const key = licenseInfo.getLicenseKey();
    console.log(key); // Outputs the current license key
    
  • setLicenseKey(key)

    • key: string (optional) - The new license key to set.

    Example:

    licenseInfo.setLicenseKey("new-license-key");
    

License

Licensed under MIT.

Keywords

FAQs

Package last updated on 08 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc