SDKs
...
Go SDK
v2
Go SDK V2
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 func (lh licensehandler) activatelicense(ctx context context) error { dl, err = lh licensemanager activatelicense(ctx) if err != nil { return err } err = lh storage savelicense(dl) if err != nil { return errors licensedatastoragefailed() } return nil } 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