lexactivator

package module
v0.0.0-...-3a73e6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2023 License: MIT Imports: 3 Imported by: 0

README

lexactivator-go

Cryptlex lets you license your software apps effortlessly. You can easily generate license keys using the REST API or Dashboard and validate the license keys in your software apps using LexActivator (Cryptlex client library).

Additionally, you can offer trials, subscriptions, floating licenses and much more.

lexactivator-go is a Go wrapper for LexActivator licensing library.

Installation

go get -u github.com/cryptlex/lexactivator-go

Note: In case you are using Windows, execute the following command after installation:

xcopy %USERPROFILE%\go\src\github.com\cryptlex\lexactivator-go\libs\windows_amd64\LexActivator.dll

Then you can include it in your code:

import "github.com/cryptlex/lexactivator-go"

Usage

Refer to following for documentation:

https://docs.cryptlex.com/node-locked-licenses/using-lexactivator/using-lexactivator-with-go

Documentation

Index

Constants

View Source
const (
	LA_USER      uint = 1
	LA_SYSTEM    uint = 2
	LA_IN_MEMORY uint = 4
)
View Source
const (
	LA_RELEASES_ALL     uint = 1
	LA_RELEASES_ALLOWED uint = 2
)
View Source
const (

	// Success code.
	LA_OK int = 0

	// Failure code.
	LA_FAIL int = 1

	// The license has expired or system time has been tampered with. Ensure your date and time settings are correct.
	LA_EXPIRED int = 20

	// The license has been suspended.
	LA_SUSPENDED int = 21

	// The grace period for server sync is over.
	LA_GRACE_PERIOD_OVER int = 22

	// The trial has expired or system time has been tampered with. Ensure your date and time settings are correct.
	LA_TRIAL_EXPIRED int = 25

	// The local trial has expired or system time has been tampered
	// with. Ensure your date and time settings are correct.
	LA_LOCAL_TRIAL_EXPIRED int = 26

	// A new update is available for the product. This means a new release has been published for the product.
	LA_RELEASE_UPDATE_AVAILABLE int = 30

	// No new update is available for the product. The current version is latest.
	LA_RELEASE_NO_UPDATE_AVAILABLE int = 31 // deprecated

	// No new update is available for the product. The current version is latest.
	LA_RELEASE_UPDATE_NOT_AVAILABLE int = 31

	// The update available is not allowed for this license.
	LA_RELEASE_UPDATE_AVAILABLE_NOT_ALLOWED int = 32

	// Invalid file path.
	LA_E_FILE_PATH int = 40

	// Invalid or corrupted product file.
	LA_E_PRODUCT_FILE int = 41

	// Invalid product data.
	LA_E_PRODUCT_DATA int = 42

	// The product id is incorrect.
	LA_E_PRODUCT_ID int = 43

	// Insufficient system permissions. Occurs when LA_SYSTEM flag is used
	// but application is not run with admin privileges.
	LA_E_SYSTEM_PERMISSION int = 44

	// No permission to write to file.
	LA_E_FILE_PERMISSION int = 45

	// Fingerprint couldn't be generated because Windows Management Instrumentation (WMI)
	// service has been disabled. This error is specific to Windows only.
	LA_E_WMIC int = 46

	// The difference between the network time and the system time is
	// more than allowed clock offset.
	LA_E_TIME int = 47

	// Failed to connect to the server due to network error.
	LA_E_INET int = 48

	// Invalid network proxy.
	LA_E_NET_PROXY int = 49

	// Invalid Cryptlex host url.
	LA_E_HOST_URL int = 50

	// The buffer size was smaller than required.
	LA_E_BUFFER_SIZE int = 51

	// App version length is more than 256 characters.
	LA_E_APP_VERSION_LENGTH int = 52

	// The license has been revoked.
	LA_E_REVOKED int = 53

	// Invalid license key.
	LA_E_LICENSE_KEY int = 54

	// Invalid license type. Make sure floating license is not being used.
	LA_E_LICENSE_TYPE int = 55

	// Invalid offline activation response file.
	LA_E_OFFLINE_RESPONSE_FILE int = 56

	// The offline activation response has expired.
	LA_E_OFFLINE_RESPONSE_FILE_EXPIRED int = 57

	// The license has reached it's allowed activations limit.
	LA_E_ACTIVATION_LIMIT int = 58

	// The license activation was deleted on the server.
	LA_E_ACTIVATION_NOT_FOUND int = 59

	// The license has reached it's allowed deactivations limit.
	LA_E_DEACTIVATION_LIMIT int = 60

	// Trial not allowed for the product.
	LA_E_TRIAL_NOT_ALLOWED int = 61

	// Your account has reached it's trial activations limit.
	LA_E_TRIAL_ACTIVATION_LIMIT int = 62

	// Machine fingerprint has changed since activation.
	LA_E_MACHINE_FINGERPRINT int = 63

	// Metadata key length is more than 256 characters.
	LA_E_METADATA_KEY_LENGTH int = 64

	// Metadata value length is more than 256 characters.
	LA_E_METADATA_VALUE_LENGTH int = 65

	// The license has reached it's metadata fields limit.
	LA_E_ACTIVATION_METADATA_LIMIT int = 66

	// The trial has reached it's metadata fields limit.
	LA_E_TRIAL_ACTIVATION_METADATA_LIMIT int = 67

	// The metadata key does not exist.
	LA_E_METADATA_KEY_NOT_FOUND int = 68

	// The system time has been tampered (backdated).
	LA_E_TIME_MODIFIED int = 69

	// Invalid version format.
	LA_E_RELEASE_VERSION_FORMAT int = 70

	// Incorrect email or password.
	LA_E_AUTHENTICATION_FAILED int = 71

	// The meter attribute does not exist.
	LA_E_METER_ATTRIBUTE_NOT_FOUND int = 72

	// The meter attribute has reached it's usage limit.
	LA_E_METER_ATTRIBUTE_USES_LIMIT_REACHED int = 73

	// Custom device fingerprint length is less than 64 characters
	// or more than 256 characters..
	LA_E_CUSTOM_FINGERPRINT_LENGTH int = 74

	// No product version is linked with the license.
	LA_E_PRODUCT_VERSION_NOT_LINKED int = 75

	// The product version feature flag does not exist.
	LA_E_FEATURE_FLAG_NOT_FOUND int = 76

	// The release version is not allowed.
	LA_E_RELEASE_VERSION_NOT_ALLOWED int = 77

	// Release platform length is more than 256 characters.
	LA_E_RELEASE_PLATFORM_LENGTH int = 78

	// Release channel length is more than 256 characters.
	LA_E_RELEASE_CHANNEL_LENGTH int = 79

	// Application is being run inside a virtual machine / hypervisor,
	// and activation has been disallowed in the VM.
	LA_E_VM int = 80

	// Country is not allowed.
	LA_E_COUNTRY int = 81

	// IP address is not allowed.
	LA_E_IP int = 82

	// Application is being run inside a container
	// and activation has been disallowed in the container.
	LA_E_CONTAINER int = 83

	// Invalid release version. Make sure the release version
	// uses the following formats: x.x, x.x.x, x.x.x.x (where x is a number).
	LA_E_RELEASE_VERSION int = 84

	// Release platform not set.
	LA_E_RELEASE_PLATFORM int = 85

	// Release channel not set.
	LA_E_RELEASE_CHANNEL int = 86

	// Rate limit for API has reached, try again later.
	LA_E_RATE_LIMIT int = 90

	// Server error.
	LA_E_SERVER int = 91

	// Client error.
	LA_E_CLIENT int = 92
)

int enumeration from lexactivator/int.h int =4

Variables

This section is empty.

Functions

func ActivateLicense

func ActivateLicense() int

FUNCTION: ActivateLicense()

PURPOSE: Activates the license by contacting the Cryptlex servers. It validates the key and returns with encrypted and digitally signed token which it stores and uses to activate your application.

This function should be executed at the time of registration, ideally on a button click.

RETURN CODES: LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_E_REVOKED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_INET, LA_E_VM, LA_E_TIME, LA_E_ACTIVATION_LIMIT, LA_E_SERVER, LA_E_CLIENT, LA_E_AUTHENTICATION_FAILED, LA_E_LICENSE_TYPE, LA_E_COUNTRY, LA_E_IP, LA_E_RATE_LIMIT, LA_E_LICENSE_KEY

func ActivateLicenseOffline

func ActivateLicenseOffline(filePath string) int

FUNCTION: ActivateLicenseOffline()

PURPOSE: Activates your licenses using the offline activation response file.

PARAMETERS: * filePath - path of the offline activation response file.

RETURN CODES: LA_OK, LA_EXPIRED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_OFFLINE_RESPONSE_FILE LA_E_VM, LA_E_TIME, LA_E_FILE_PATH, LA_E_OFFLINE_RESPONSE_FILE_EXPIRED

func ActivateLocalTrial

func ActivateLocalTrial(trialLength uint) int

FUNCTION: ActivateLocalTrial()

PURPOSE: Starts the local(unverified) trial.

This function should be executed when your application starts first time on the user's computer.

PARAMETERS: * trialLength - trial length in days

RETURN CODES: LA_OK, LA_LOCAL_TRIAL_EXPIRED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME_MODIFIED

NOTE: The function is only meant for local(unverified) trials.

func ActivateTrial

func ActivateTrial() int

FUNCTION: ActivateTrial()

PURPOSE: Starts the verified trial in your application by contacting the Cryptlex servers.

This function should be executed when your application starts first time on the user's computer, ideally on a button click.

RETURN CODES: LA_OK, LA_TRIAL_EXPIRED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_INET, LA_E_VM, LA_E_TIME, LA_E_SERVER, LA_E_CLIENT, LA_E_COUNTRY, LA_E_IP, LA_E_RATE_LIMIT

func ActivateTrialOffline

func ActivateTrialOffline(filePath string) int

FUNCTION: ActivateTrialOffline()

PURPOSE: Activates your trial using the offline activation response file.

PARAMETERS: * filePath - path of the offline activation response file.

RETURN CODES: LA_OK, LA_TRIAL_EXPIRED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_OFFLINE_RESPONSE_FILE LA_E_VM, LA_E_TIME, LA_E_FILE_PATH, LA_E_OFFLINE_RESPONSE_FILE_EXPIRED

func CheckForReleaseUpdate

func CheckForReleaseUpdate(platform string, version string, channel string, callbackFunction func(int)) int

FUNCTION: CheckForReleaseUpdate()

PURPOSE: Checks whether a new release is available for the product.

This function should only be used if you manage your releases through Cryptlex release management API.

PARAMETERS: * platform - release platform e.g. windows, macos, linux * version - current release version * channel - release channel e.g. stable * releaseUpdateCallback - name of the callback function.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_RELEASE_VERSION_FORMAT

func CheckReleaseUpdate

func CheckReleaseUpdate(releaseUpdateCallbackFunction func(int, *Release, interface{}), releaseFlags uint, userData interface{}) int

FUNCTION: CheckReleaseUpdate()

PURPOSE: Checks whether a new release is available for the product.

This function should only be used if you manage your releases through Cryptlex release management API.

When this function is called the release update callback function gets invoked which passes the following parameters:

  • status - determines if any update is available or not. It also determines whether an update is allowed or not. Expected values are LA_RELEASE_UPDATE_AVAILABLE, LA_RELEASE_UPDATE_NOT_AVAILABLE, LA_RELEASE_UPDATE_AVAILABLE_NOT_ALLOWED.
  • release- returns release struct of the latest available release, depending on the flag LA_RELEASES_ALLOWED or LA_RELEASES_ALL passed to the CheckReleaseUpdate().
  • userData - data that is passed to the callback function when it is registered using the CheckReleaseUpdate function. This parameter is optional and can be nil if no user data is passed to the CheckReleaseUpdate function.

PARAMETERS:

  • releaseUpdateCallback - name of the callback function.
  • releaseFlags - if an update only related to the allowed release is required, then use LA_RELEASES_ALLOWED. Otherwise, if an update for all the releases is required, then use LA_RELEASES_ALL.
  • userData - data that can be passed to the callback function. This parameter has to be nil if no user data needs to be passed to the callback.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_RELEASE_VERSION_FORMAT, LA_E_RELEASE_VERSION, LA_E_RELEASE_PLATFORM, LA_E_RELEASE_CHANNEL

func DeactivateLicense

func DeactivateLicense() int

FUNCTION: DeactivateLicense()

PURPOSE: Deactivates the license activation and frees up the corresponding activation slot by contacting the Cryptlex servers.

This function should be executed at the time of de-registration, ideally on a button click.

RETURN CODES: LA_OK, LA_E_DEACTIVATION_LIMIT, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME LA_E_LICENSE_KEY, LA_E_INET, LA_E_SERVER, LA_E_RATE_LIMIT, LA_E_TIME_MODIFIED

func DecrementActivationMeterAttributeUses

func DecrementActivationMeterAttributeUses(name string, decrement uint) int

FUNCTION: DecrementActivationMeterAttributeUses()

PURPOSE: Decrements the meter attribute uses of the activation.

PARAMETERS: * name - name of the meter attribute * decrement - the decrement value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METER_ATTRIBUTE_NOT_FOUND, LA_E_INET, LA_E_TIME, LA_E_SERVER, LA_E_CLIENT, LA_E_RATE_LIMIT, LA_E_LICENSE_KEY, LA_E_AUTHENTICATION_FAILED, LA_E_COUNTRY, LA_E_IP, LA_E_ACTIVATION_NOT_FOUND

NOTE: If the decrement is more than the current uses, it resets the uses to 0.

func Dummy

func Dummy()

func ExtendLocalTrial

func ExtendLocalTrial(trialExtensionLength uint) int

FUNCTION: ExtendLocalTrial()

PURPOSE: Extends the local trial.

PARAMETERS: * trialExtensionLength - number of days to extend the trial

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME_MODIFIED

NOTE: The function is only meant for local(unverified) trials.

func GenerateOfflineActivationRequest

func GenerateOfflineActivationRequest(filePath string) int

FUNCTION: GenerateOfflineActivationRequest()

PURPOSE: Generates the offline activation request needed for generating offline activation response in the dashboard.

PARAMETERS: * filePath - path of the file for the offline request.

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_FILE_PERMISSION

func GenerateOfflineDeactivationRequest

func GenerateOfflineDeactivationRequest(filePath string) int

FUNCTION: GenerateOfflineDeactivationRequest()

PURPOSE: Generates the offline deactivation request needed for deactivation of the license in the dashboard and deactivates the license locally.

A valid offline deactivation file confirms that the license has been successfully deactivated on the user's machine.

PARAMETERS: * filePath - path of the file for the offline request.

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_FILE_PERMISSION, LA_E_TIME, LA_E_TIME_MODIFIED

func GenerateOfflineTrialActivationRequest

func GenerateOfflineTrialActivationRequest(filePath string) int

FUNCTION: GenerateOfflineTrialActivationRequest()

PURPOSE: Generates the offline trial activation request needed for generating offline trial activation response in the dashboard.

PARAMETERS: * filePath - path of the file for the offline request.

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_FILE_PERMISSION

func GetActivationMetadata

func GetActivationMetadata(key string, value *string) int

FUNCTION: GetActivationMetadata()

PURPOSE: Gets the activation metadata.

PARAMETERS: * key - metadata key to retrieve the value * value - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_NOT_FOUND, LA_E_BUFFER_SIZE

func GetActivationMeterAttributeUses

func GetActivationMeterAttributeUses(name string, uses *uint) int

FUNCTION: GetActivationMeterAttributeUses()

PURPOSE: Gets the meter attribute uses consumed by the activation.

PARAMETERS: * name - name of the meter attribute * allowedUses - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METER_ATTRIBUTE_NOT_FOUND

func GetActivationMode

func GetActivationMode(initialMode *string, currentMode *string) int

FUNCTION: GetActivationMode()

PURPOSE: Gets the mode of activation (online or offline).

PARAMETERS: * initialMode - pointer to a buffer that receives the initial mode of activation * initialModeLength - size of the buffer pointed to by the initialMode parameter * currentMode - pointer to a buffer that receives the current mode of activation * currentModeLength - size of the buffer pointed to by the currentMode parameter

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLibraryVersion

func GetLibraryVersion(libraryVersion *string) int

FUNCTION: GetLibraryVersion()

PURPOSE: Gets the version of this library.

PARAMETERS: * libraryVersion - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the libraryVersion parameter

RETURN CODES: LA_OK, LA_E_BUFFER_SIZE

func GetLicenseAllowedActivations

func GetLicenseAllowedActivations(allowedActivations *uint) int

FUNCTION: GetLicenseAllowedActivations()

PURPOSE: Gets the allowed activations of the license.

PARAMETERS: * allowedActivations - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED

func GetLicenseExpiryDate

func GetLicenseExpiryDate(expiryDate *uint) int

FUNCTION: GetLicenseExpiryDate()

PURPOSE: Gets the license expiry date timestamp.

PARAMETERS: * expiryDate - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED

func GetLicenseKey

func GetLicenseKey(licenseKey *string) int

FUNCTION: GetLicenseKey()

PURPOSE: Gets the license key used for activation.

PARAMETERS: * licenseKey - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_BUFFER_SIZE

func GetLicenseMaintenanceExpiryDate

func GetLicenseMaintenanceExpiryDate(maintenanceExpiryDate *uint) int

FUNCTION: GetLicenseMaintenanceExpiryDate()

PURPOSE: Gets the license maintenance expiry date timestamp.

PARAMETERS: * maintenanceExpiryDate - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_TIME, LA_E_TIME_MODIFIED

func GetLicenseMaxAllowedReleaseVersion

func GetLicenseMaxAllowedReleaseVersion(maxAllowedReleaseVersion *string) int

FUNCTION: GetLicenseMaxAllowedReleaseVersion()

PURPOSE: Gets the maximum allowed release version of the license.

PARAMETERS: * maxAllowedReleaseVersion - pointer to a buffer that receives the value of the string. * length - size of the buffer pointed to by the maxAllowedReleaseVersion parameter.

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseMetadata

func GetLicenseMetadata(key string, value *string) int

FUNCTION: GetLicenseMetadata()

PURPOSE: Gets the license metadata as set in the dashboard.

PARAMETERS: * key - metadata key to retrieve the value * value - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_NOT_FOUND, LA_E_BUFFER_SIZE

func GetLicenseMeterAttribute

func GetLicenseMeterAttribute(name string, allowedUses *uint, totalUses *uint, grossUses *uint) int

FUNCTION: GetLicenseMeterAttribute()

PURPOSE: Gets the license meter attribute allowed uses, total and gross uses.

PARAMETERS: * name - name of the meter attribute * allowedUses - pointer to the integer that receives the value * totalUses - pointer to the integer that receives the value * grossUses - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METER_ATTRIBUTE_NOT_FOUND

func GetLicenseOrganizationAddress

func GetLicenseOrganizationAddress(organizationAddress *OrganizationAddress) int

FUNCTION: GetLicenseOrganizationAddress()

PURPOSE: Gets the organization address associated with the license.

PARAMETERS: * organizationAddress - pointer to the OrganizationAddress struct that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseOrganizationName

func GetLicenseOrganizationName(organizationName *string) int

FUNCTION: GetLicenseOrganizationName()

PURPOSE: Gets the organization name associated with the license.

PARAMETERS: * organizationName - pointer to the string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseTotalActivations

func GetLicenseTotalActivations(totalActivations *uint) int

FUNCTION: GetLicenseTotalActivations()

PURPOSE: Gets the total activations of the license.

PARAMETERS: * totalActivations - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED

func GetLicenseType

func GetLicenseType(licenseType *string) int

FUNCTION: GetLicenseType()

PURPOSE: Gets the license type (node-locked or hosted-floating).

PARAMETERS: * licenseType - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseUserCompany

func GetLicenseUserCompany(company *string) int

FUNCTION: GetLicenseUserCompany()

PURPOSE: Gets the company associated with the license user.

PARAMETERS: * company - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseUserEmail

func GetLicenseUserEmail(email *string) int

FUNCTION: GetLicenseUserEmail()

PURPOSE: Gets the email associated with license user.

PARAMETERS: * email - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLicenseUserMetadata

func GetLicenseUserMetadata(key string, value *string) int

FUNCTION: GetLicenseUserMetadata()

PURPOSE: Gets the metadata associated with the license user.

PARAMETERS: * key - metadata key to retrieve the value * value - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_NOT_FOUND, LA_E_BUFFER_SIZE

func GetLicenseUserName

func GetLicenseUserName(name *string) int

FUNCTION: GetLicenseUserName()

PURPOSE: Gets the name associated with the license user.

PARAMETERS: * name - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func GetLocalTrialExpiryDate

func GetLocalTrialExpiryDate(trialExpiryDate *uint) int

FUNCTION: GetLocalTrialExpiryDate()

PURPOSE: Gets the trial expiry date timestamp.

PARAMETERS: * trialExpiryDate - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME_MODIFIED

func GetProductMetadata

func GetProductMetadata(key string, value *string) int

FUNCTION: GetProductMetadata()

PURPOSE: Gets the product metadata as set in the dashboard.

This is available for trial as well as license activations.

PARAMETERS: * key - metadata key to retrieve the value * value - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_NOT_FOUND, LA_E_BUFFER_SIZE

func GetProductVersionDisplayName

func GetProductVersionDisplayName(displayName *string) int

FUNCTION: GetProductVersionDisplayName()

PURPOSE: Gets the product version display name.

PARAMETERS: * displayName - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the displayName parameter

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_PRODUCT_VERSION_NOT_LINKED, LA_E_BUFFER_SIZE

func GetProductVersionFeatureFlag

func GetProductVersionFeatureFlag(name string, enabled *bool, data *string) int

FUNCTION: GetProductVersionFeatureFlag()

PURPOSE: Gets the product version feature flag.

PARAMETERS: * name - name of the feature flag * enabled - pointer to the integer that receives the value - 0 or 1 * data - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the data parameter

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_PRODUCT_VERSION_NOT_LINKED, LA_E_FEATURE_FLAG_NOT_FOUND, LA_E_BUFFER_SIZE

func GetProductVersionName

func GetProductVersionName(name *string) int

func GetServerSyncGracePeriodExpiryDate

func GetServerSyncGracePeriodExpiryDate(expiryDate *uint) int

FUNCTION: GetServerSyncGracePeriodExpiryDate()

PURPOSE: Gets the server sync grace period expiry date timestamp.

PARAMETERS: * expiryDate - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED

func GetTrialActivationMetadata

func GetTrialActivationMetadata(key string, value *string) int

FUNCTION: GetTrialActivationMetadata()

PURPOSE: Gets the trial activation metadata.

PARAMETERS: * key - metadata key to retrieve the value * value - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_NOT_FOUND, LA_E_BUFFER_SIZE

func GetTrialExpiryDate

func GetTrialExpiryDate(trialExpiryDate *uint) int

FUNCTION: GetTrialExpiryDate()

PURPOSE: Gets the trial expiry date timestamp.

PARAMETERS: * trialExpiryDate - pointer to the integer that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED

func GetTrialId

func GetTrialId(trialId *string) int

FUNCTION: GetTrialId()

PURPOSE: Gets the trial activation id. Used in case of trial extension.

PARAMETERS: * trialId - pointer to a string that receives the value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME, LA_E_TIME_MODIFIED, LA_E_BUFFER_SIZE

func IncrementActivationMeterAttributeUses

func IncrementActivationMeterAttributeUses(name string, increment uint) int

FUNCTION: IncrementActivationMeterAttributeUses()

PURPOSE: Increments the meter attribute uses of the activation.

PARAMETERS: * name - name of the meter attribute * increment - the increment value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METER_ATTRIBUTE_NOT_FOUND, LA_E_INET, LA_E_TIME, LA_E_SERVER, LA_E_CLIENT, LA_E_METER_ATTRIBUTE_USES_LIMIT_REACHED, LA_E_AUTHENTICATION_FAILED, LA_E_COUNTRY, LA_E_IP, LA_E_RATE_LIMIT, LA_E_LICENSE_KEY

func IsLicenseGenuine

func IsLicenseGenuine() int

FUNCTION: IsLicenseGenuine()

PURPOSE: It verifies whether your app is genuinely activated or not. The verification is done locally by verifying the cryptographic digital signature fetched at the time of activation.

After verifying locally, it schedules a server check in a separate thread. After the first server sync it periodically does further syncs at a frequency set for the license.

In case server sync fails due to network error, and it continues to fail for fixed number of days (grace period), the function returns LA_GRACE_PERIOD_OVER instead of LA_OK.

This function must be called on every start of your program to verify the activation of your app.

RETURN CODES: LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_GRACE_PERIOD_OVER, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_TIME, LA_E_TIME_MODIFIED

NOTE: If application was activated offline using ActivateLicenseOffline() function, you may want to set grace period to 0 to ignore grace period.

func IsLicenseValid

func IsLicenseValid() int

FUNCTION: IsLicenseValid()

PURPOSE: It verifies whether your app is genuinely activated or not. The verification is done locally by verifying the cryptographic digital signature fetched at the time of activation.

This is just an auxiliary function which you may use in some specific cases, when you want to skip the server sync.

RETURN CODES: LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_GRACE_PERIOD_OVER, LA_FAIL, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_TIME, LA_E_TIME_MODIFIED

NOTE: You may want to set grace period to 0 to ignore grace period.

func IsLocalTrialGenuine

func IsLocalTrialGenuine() int

FUNCTION: IsLocalTrialGenuine()

PURPOSE: It verifies whether trial has started and is genuine or not. The verification is done locally.

This function must be called on every start of your program during the trial period.

RETURN CODES: LA_OK, LA_LOCAL_TRIAL_EXPIRED, LA_FAIL, LA_E_PRODUCT_ID, LA_E_TIME_MODIFIED

NOTE: The function is only meant for local(unverified) trials.

func IsTrialGenuine

func IsTrialGenuine() int

FUNCTION: IsTrialGenuine()

PURPOSE: It verifies whether trial has started and is genuine or not. The verification is done locally by verifying the cryptographic digital signature fetched at the time of trial activation.

This function must be called on every start of your program during the trial period.

RETURN CODES: LA_OK, LA_TRIAL_EXPIRED, LA_FAIL, LA_E_TIME, LA_E_PRODUCT_ID, LA_E_TIME_MODIFIED

func Reset

func Reset() int

FUNCTION: Reset()

PURPOSE: Resets the activation and trial data stored in the machine.

This function is meant for developer testing only.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID

NOTE: The function does not reset local(unverified) trial data.

func ResetActivationMeterAttributeUses

func ResetActivationMeterAttributeUses(name string) int

FUNCTION: ResetActivationMeterAttributeUses()

PURPOSE: Resets the meter attribute uses consumed by the activation.

PARAMETERS: * name - name of the meter attribute * decrement - the decrement value

RETURN CODES: LA_OK, LA_FAIL, LA_E_PRODUCT_ID, LA_E_METER_ATTRIBUTE_NOT_FOUND, LA_E_INET, LA_E_TIME, LA_E_SERVER, LA_E_CLIENT, LA_E_RATE_LIMIT, LA_E_LICENSE_KEY, LA_E_AUTHENTICATION_FAILED, LA_E_COUNTRY, LA_E_IP, LA_E_ACTIVATION_NOT_FOUND

func SetActivationLeaseDuration

func SetActivationLeaseDuration(leaseDuration uint) int

FUNCTION: SetActivationLeaseDuration()

PURPOSE: Sets the lease duration for the activation.

The activation lease duration is honoured when the allow client lease duration property is enabled.

PARAMETERS: * leaseDuration - value of the lease duration.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY

func SetActivationMetadata

func SetActivationMetadata(key string, value string) int

FUNCTION: SetActivationMetadata()

PURPOSE: Sets the activation metadata.

The metadata appears along with the activation details of the license in dashboard.

PARAMETERS: * key - string of maximum length 256 characters with utf-8 encoding. * value - string of maximum length 256 characters with utf-8 encoding.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY, LA_E_METADATA_KEY_LENGTH, LA_E_METADATA_VALUE_LENGTH, LA_E_ACTIVATION_METADATA_LIMIT

func SetAppVersion

func SetAppVersion(appVersion string) int

FUNCTION: SetAppVersion()

PURPOSE: Sets the current app version of your application.

The app version appears along with the activation details in dashboard. It is also used to generate app analytics.

PARAMETERS: * appVersion - string of maximum length 256 characters with utf-8 encoding.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_APP_VERSION_LENGTH

func SetCryptlexHost

func SetCryptlexHost(host string) int

FUNCTION: SetCryptlexHost()

PURPOSE: In case you are running Cryptlex on-premise, you can set the host for your on-premise server.

PARAMETERS: * host - the address of the Cryptlex on-premise server

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_HOST_URL

func SetCustomDeviceFingerprint

func SetCustomDeviceFingerprint(fingerprint string) int

FUNCTION: SetCustomDeviceFingerprint()

PURPOSE: In case you don't want to use the LexActivator's advanced device fingerprinting algorithm, this function can be used to set a custom device fingerprint.

If you decide to use your own custom device fingerprint then this function must be called on every start of your program immediately after calling SetProductFile() or SetProductData() function.

The license fingerprint matching strategy is ignored if this function is used.

PARAMETERS: * fingerprint - string of minimum length 64 characters and maximum length 256 characters.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_CUSTOM_FINGERPRINT_LENGTH

func SetDataDirectory

func SetDataDirectory(directoryPath string) int

FUNCTION: SetDataDirectory()

PURPOSE: In case you want to change the default directory used by LexActivator to store the activation data on Linux and macOS, this function can be used to set a different directory.

If you decide to use this function, then it must be called on every start of your program before calling SetProductFile() or SetProductData() function.

Please ensure that the directory exists and your app has read and write permissions in the directory.

PARAMETERS: * directoryPath - absolute path of the directory.

RETURN CODES: LA_OK, LA_E_FILE_PERMISSION

func SetLicenseCallback

func SetLicenseCallback(callbackFunction func(int)) int

FUNCTION: SetLicenseCallback()

PURPOSE: Sets server sync callback function.

Whenever the server sync occurs in a separate thread, and server returns the response, license callback function gets invoked with the following status codes: LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_E_REVOKED, LA_E_ACTIVATION_NOT_FOUND, LA_E_MACHINE_FINGERPRINT LA_E_AUTHENTICATION_FAILED, LA_E_COUNTRY, LA_E_INET, LA_E_SERVER, LA_E_RATE_LIMIT, LA_E_IP

PARAMETERS: * callback - name of the callback function

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY

func SetLicenseKey

func SetLicenseKey(licenseKey string) int

FUNCTION: SetLicenseKey()

PURPOSE: Sets the license key required to activate the license.

PARAMETERS: * licenseKey - a valid license key.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY

func SetLicenseUserCredential

func SetLicenseUserCredential(email string, password string) int

FUNCTION: SetLicenseUserCredential()

PURPOSE: Sets the license user email and password for authentication.

This function must be called before ActivateLicense() or IsLicenseGenuine() function if 'requireAuthentication' property of the license is set to true.

PARAMETERS: * email - user email address. * password - user password.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY

func SetNetworkProxy

func SetNetworkProxy(proxy string) int

FUNCTION: SetNetworkProxy()

PURPOSE: Sets the network proxy to be used when contacting Cryptlex servers.

The proxy format should be: [protocol://][username:password@]machine[:port]

Following are some examples of the valid proxy strings:

PARAMETERS: * proxy - proxy string having correct proxy format

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_NET_PROXY

NOTE: Proxy settings of the computer are automatically detected. So, in most of the cases you don't need to care whether your user is behind a proxy server or not.

func SetOfflineActivationRequestMeterAttributeUses

func SetOfflineActivationRequestMeterAttributeUses(name string, uses uint) int

FUNCTION: SetOfflineActivationRequestMeterAttributeUses()

PURPOSE: Sets the meter attribute uses for the offline activation request.

This function should only be called before GenerateOfflineActivationRequest() function to set the meter attributes in case of offline activation.

PARAMETERS: * name - name of the meter attribute * uses - the uses value

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_LICENSE_KEY

func SetProductData

func SetProductData(productData string) int

FUNCTION: SetProductData()

PURPOSE: Embeds the Product.dat file in the application.

It can be used instead of SetProductFile() in case you want to embed the Product.dat file in your application.

This function must be called on every start of your program before any other functions are called.

PARAMETERS: * productData - content of the Product.dat file

RETURN CODES: LA_OK, LA_E_PRODUCT_DATA

NOTE: If this function fails to set the product data, none of the other functions will work.

func SetProductFile

func SetProductFile(filePath string) int

FUNCTION: SetProductFile()

PURPOSE: Sets the absolute path of the Product.dat file.

This function must be called on every start of your program before any other functions are called.

PARAMETERS: * filePath - absolute path of the product file (Product.dat)

RETURN CODES: LA_OK, LA_E_FILE_PATH, LA_E_PRODUCT_FILE

NOTE: If this function fails to set the path of product file, none of the other functions will work.

func SetProductId

func SetProductId(productId string, flags uint) int

FUNCTION: SetProductId()

PURPOSE: Sets the product id of your application.

This function must be called on every start of your program before any other functions are called, with the exception of SetProductFile() or SetProductData() function.

PARAMETERS:

  • productId - the unique product id of your application as mentioned on the product page in the dashboard.
  • flags - depending upon whether your application requires admin/root permissions to run or not, this parameter can have one of the following values: LA_SYSTEM, LA_USER, LA_IN_MEMORY

RETURN CODES: LA_OK, LA_E_WMIC, LA_E_PRODUCT_FILE, LA_E_PRODUCT_DATA, LA_E_PRODUCT_ID, LA_E_SYSTEM_PERMISSION

NOTE: If this function fails to set the product id, none of the other functions will work.

func SetReleaseChannel

func SetReleaseChannel(releaseChannel string) int

FUNCTION: SetReleaseChannel()

PURPOSE: Sets the release channel e.g. stable, beta

The release channel appears along with the activation details in dashboard.

PARAMETERS: * channel - release channel e.g. stable

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_RELEASE_CHANNEL_LENGTH

func SetReleasePlatform

func SetReleasePlatform(releasePlatform string) int

FUNCTION: SetReleasePlatform()

PURPOSE: Sets the release platform e.g. windows, macos, linux

The release platform appears along with the activation details in dashboard.

PARAMETERS: * releasePlatform - release platform e.g. windows, macos, linux

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_RELEASE_PLATFORM_LENGTH

func SetReleasePublishedDate

func SetReleasePublishedDate(releasePublishedDate uint) int

FUNCTION: SetReleasePublishedDate()

PURPOSE: Sets the release published date of your application.

PARAMETERS: * releasePublishedDate - unix timestamp of release published date.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID

func SetReleaseVersion

func SetReleaseVersion(releaseVersion string) int

FUNCTION: SetReleaseVersion()

PURPOSE: Sets the current release version of your application.

The release version appears along with the activation details in dashboard.

PARAMETERS: * releaseVersion - string in following allowed formats: x.x, x.x.x, x.x.x.x

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_RELEASE_VERSION_FORMAT

func SetTrialActivationMetadata

func SetTrialActivationMetadata(key string, value string) int

FUNCTION: SetTrialActivationMetadata()

PURPOSE: Sets the trial activation metadata.

The metadata appears along with the trial activation details of the product in dashboard.

PARAMETERS: * key - string of maximum length 256 characters with utf-8 encoding. * value - string of maximum length 256 characters with utf-8 encoding.

RETURN CODES: LA_OK, LA_E_PRODUCT_ID, LA_E_METADATA_KEY_LENGTH, LA_E_METADATA_VALUE_LENGTH, LA_E_TRIAL_ACTIVATION_METADATA_LIMIT

Types

type OrganizationAddress

type OrganizationAddress struct {
	AddressLine1 string `json:"addressLine1"`
	AddressLine2 string `json:"addressLine2"`
	City         string `json:"city"`
	State        string `json:"state"`
	Country      string `json:"country"`
	PostalCode   string `json:"postalCode"`
}

type Release

type Release struct {
	TotalFiles  int           `json:"totalFiles"`
	IsPrivate   bool          `json:"isPrivate"`
	Published   bool          `json:"published"`
	Id          string        `json:"id"`
	CreatedAt   string        `json:"createdAt"`
	UpdatedAt   string        `json:"updatedAt"`
	Name        string        `json:"name"`
	Channel     string        `json:"channel"`
	Version     string        `json:"version"`
	Notes       string        `json:"notes"`
	PublishedAt string        `json:"publishedAt"`
	ProductId   string        `json:"productId"`
	Platforms   []string      `json:"platforms"`
	Files       []ReleaseFile `json:"files"`
}

type ReleaseFile

type ReleaseFile struct {
	Size      int    `json:"size"`
	Downloads int    `json:"downloads"`
	Secured   bool   `json:"secured"`
	Id        string `json:"id"`
	Name      string `json:"name"`
	Url       string `json:"url"`
	Extension string `json:"extension"`
	Checksum  string `json:"checksum"`
	ReleaseId string `json:"releaseId"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL