Go SDK V2

License Manager

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

Struct Definition

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

Constructor Functions

To create a new license manager, use:

constructors.go
NewLicenseManager(apiKey, sharedKey, 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:

license_client.go
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

circle-info

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.

Was this helpful?