SDKs
...
Go SDK
v2

Overview

8min

License Manager

The LicenseManager is the core module responsible for managing licenses, communicating with the LicenseSpring server, and handling authentication.

Struct Definition

type LicenseManager struct { LicenseClient license_client.LicenseClient LicenseData *types.LicenseData types.OfflineActivationGuard }

Constructor Functions

To create a new license manager, use:

NewLicenseManager(apiKey, sharedKey, productCode string, authData auth.Auth, opts ...ConfigurationOption) (*LicenseManager, error)

For OAuth-based configurations, use:

NewLicenseManagerOAuth(clientId, clientSecret, cryptoKey, productCode string, authData auth.Auth, opts ...ConfigurationOption) (*LicenseManager, error)

License Client Configuration

The LicenseManager includes a LicenseClient, which contains all configuration for interacting with the server:

type LicenseClient struct { c *client.Client LicenseClientConfiguration }

Storage

Storage is responsible for securely persisting license-related data such as license files, guard files, and encrypted custom data.

License Handler

The LicenseHandler is the user-facing layer that wraps the LicenseManager and Storage. It acts as a coordinator:

  • Calls the license manager to perform actions (e.g. activation)
  • Persists the resulting data to storage (e.g. license file)
  • Manages offline guard file storage
  • Decouples core logic (license manager) from the storage mechanism

Example: License Activation Flow

Go


Note on Extensibility

The LicenseManager is completely decoupled from the storage implementation. This allows the replacement of the storage layer without changing the license logic.

For example, when floating server support is added in the future:

  • We can implement a new Storage logic
  • Use the existing LicenseManager as-is
  • Replace LicenseHandler with a FloatingServerHandler or similar

More details about license handler in next section.