SDKs
...
v2
License Handler
Configuration Options
16min
configuration options for license manager the licensemanager in the sdk provides several configuration options that allow you to tailor its behavior to your specific use cases, including air gapped environments, logging control, offline support, and more custom logger (resty) the license manager uses a resty client to communicate with licensespring’s api by default, resty logs to standard output you can override this behavior by passing a custom logger using withrestylogger withrestylogger(restylogger resty logger) type customlogger struct{} func (fl customlogger) debugf(format string, v interface{}) {} func (fl customlogger) errorf(format string, v interface{}) {} func (fl customlogger) warnf(format string, v interface{}) {} lm config = license manager licensemanagerbasicconfiguration{ 	 oauth false, 	 apikey "your api key", 	 sharedkey "your shared key", 	 productcode "your product code", 	 authdata auth fromkey("license key"), 	 } lm, = license manager newlicensemanager( lm config, license manager withrestylogger(customlogger), ) cfg manager = lm lh, = license handler newlicensehandler(cfg) withairgappublickey withairgappublickey(airgappublickey string) this option is required for air gapped licenses the airgap public key can be found on your licensespring dashboard and is separate from your api and shared keys withgraceperiod withgraceperiod(graceperiod int) by default, the sdk allows the license to be offline for 48 hours before invalidating it this option lets you customize the duration of this grace period withsyncperiod withsyncperiod(syncperiod int) sets how frequently (in seconds) the sdk should try to synchronize the license with the server withrestyverbose withrestyverbose(verbose bool) when set to true , the sdk outputs detailed logs for licenseclient operations withverifysignature withverifysignature(verifysig bool) when enabled, this option enforces signature verification on all responses from licensespring withenableguardfile withenableguardfile(enableguardfile bool) this enables the use of guard files to protect against reuse of offline activation requests and ensure that hardware ids match withhardwareid withhardwareid(hardwareid string) overrides the hardware id used to identify the device withappname withappname(appname string) overrides the app name withappversion withappversion(appversion string) overrides the app version withserverpublickey withserverpublickey(publickey string) overrides the server public key used to verify the signature in api responses setting up this value is mandatory if you are using a server other than licensespring's servers withhardwareidalgo withhardwareidalgo(hardwareid string) overrides the hardware id used to identify the device you can use this configuration option if you want to enable the built in hardware id module, which supports multiple hardware id algorithms you’ll need to select one of the supported algorithms from the list below hwidalgorithmwindowsfingerprint hwidalgorithmcomputersystemproduct hwidalgorithmcryptography hwidalgorithmlinuxmachineid hwidalgorithmcloudplatform each algorithm generates the hardware id differently depending on the operating system and environment choose the one that best fits your use case const ( 	default hardwareidalgorithm = iota 	windowshardwarefingerprintid 	windowscomputersystemproductid 	windowscryptographyid 	linuxmachineid 	cloudplatformsid ) withmachineid withmachineid() overrides the hardware id and sets it to match the machine id used in sdk v1 use this option if you want to maintain compatibility with the hardware id format from v1