Handler

The SDK exposes two entry points:

  • LicenseHandler: Use this when you are working with a single license.

  • LicenseBundleHandler: Use this when you are working with a bundle that contains multiple licenses, (starting from v2.1.0).

Both handlers orchestrate activation and storage by composing the same core modules:

  • LicenseManager: Handles license logic, requests, and validations.

  • Storage: Persists license data (e.g., license files, guard files) securely.

LicenseHandler

The LicenseHandler is the primary entry point for single-license workflows. It initializes and connects the core modules (LicenseManager + Storage) and provides a unified interface to activate, validate, and persist a single license.

We provide a single setup function, SetupHandler, which simplifies configuration and lets you use either API Key authentication or OAuth.

The NewLicenseHandler function is the primary way to set up the LicenseHandler. It initializes and connects the core modules.

func NewLicenseHandler(
config LicenseHandlerConfig,
) (*LicenseHandler, error)

config: Required configuration fields such as API keys, product code, and license key.

What It Returns

Calling NewLicenseHandler constructs and returns a fully functional *LicenseHandler with:

  • A configured LicenseManager

  • A configured Storage backend

  • A unified interface to handle license activation, checking, and storage operations

LicenseBundleHandler

The LicenseBundleHandler is the entry point for bundle workflows. A bundle represents multiple licenses managed together under one handler instance.

It composes:

  • LicenseBundleManager

  • Storage

Where a LicenseBundleManager includes an array modeling a collection of licenses.

What It Returns

Calling NewBundleHandler(...) constructs and returns a fully functional *BundleHandler with:

  • A configured LicenseBundleManager

  • A configured Storage backend

  • A unified interface to activate/sync a bundle and work with the licenses included in that bundle.

Basic Setup

This section shows minimal setup with defaults for both handlers. These examples use:

  • API key authentication (non-OAuth)

  • Default Managers

  • Default file-based storage with encryption using the shared key

Minimal Setup with Defaults (LicenseHandler)

Minimal Setup with Defaults (LicenseBundleHandler)

Advanced Usage

Providing a Custom LicenseManager

A demonstration of using different configuration options is shown here on a LicenseManager instance. This can be applied to LicenseBundleManager as well.

OAuth Setup

When using OAuth, you have two options:

Manually create a License or Bundle Manager using OAuth and inject it into the handler config

Provide OAuth-related fields via configuration object, allowing NewLicenseHandler or NewBundleHandler to construct the manager internally.

Manager Configuration Options

The SDK provides LicenseManager to manage a single license and LicenseBundleManager to manage a bundle of licenses.

Both managers are initialized from a “basic configuration” struct that contains your auth mode (API key or OAuth), credentials, and AuthData.

LicenseManager

Use NewLicenseManager(...) (or NewLicenseManagerOAuth(...)) with LicenseManagerBasicConfiguration:

LicenseBundleManager (bundle containing multiple licenses)

Use NewLicenseBundleManager(...) with LicenseBundleConfiguration:

  • BaseUrl and ApiPrefix allow overriding the default server endpoint.

  • ServerPublicKey is used for signature verification (can be left as default).

Available Options

Both managers support the same optional configuration functions to override defaults (hardware ID, grace period, logging, offline/air-gapped behavior, etc.):

These options can be passed as variadic arguments to:

  • NewLicenseManager(...)

  • NewLicenseBundleManager(...)

Last updated

Was this helpful?