KEYZY C++ Client Library 1.9.0
To develop software that is compiled with a C++ compiler and utilizes the KEYZY service (www.keyzy.io)
Loading...
Searching...
No Matches
Keyzy::KeyzyLicenseActivator Class Reference

Activates and deactivates licenses — online, semi-online, offline, trial, and upgrade flows. The main entry point for most integrations. More...

#include <KeyzyLicenseActivator.h>

Public Member Functions

 KeyzyLicenseActivator (const ProductData &productData)
LicenseStatus activateOnline (const std::string &serialNumber)
LicenseStatus deactivateOnline ()
LicenseStatus activateSemiOnline (const std::string &serialNumber)
LicenseStatus activateSemiOnline ()
LicenseStatus deactivateSemiOnline ()
LicenseStatus activateOffline (const std::string &licenseFilePath)
bool deactivateOffline ()
LicenseStatus activateClientTrial (const std::tm &endTime)
bool deactivateClientTrial ()
LicenseStatus upgradeLicense (const std::string &targetSerial)
LicenseStatus upgradeLicense (const std::string &sourceSerial, const std::string &targetSerial)
std::shared_ptr< KeyzyLicenseValidatorgetLicenseValidator ()
std::shared_ptr< LicenseDepositHandlergetLicenseDepositHandler ()

Detailed Description

Activates and deactivates licenses — online, semi-online, offline, trial, and upgrade flows. The main entry point for most integrations.

Constructor & Destructor Documentation

◆ KeyzyLicenseActivator()

Keyzy::KeyzyLicenseActivator::KeyzyLicenseActivator ( const ProductData & productData)

Create an instance of KeyzyLicenseActivator that will activate / deactivate licenses for a product defined in ProductData structure

Parameters
productDataStructure that describes a product for which going to set/delete licenses

Member Function Documentation

◆ activateOnline()

LicenseStatus Keyzy::KeyzyLicenseActivator::activateOnline ( const std::string & serialNumber)

Sets the serial number to the device and validate it with KEYZY service If the validation fails, it deletes the serial number from the device

◆ deactivateOnline()

LicenseStatus Keyzy::KeyzyLicenseActivator::deactivateOnline ( )

Deactivate the license with KEYZY service and delete the serial number from the device

◆ activateSemiOnline() [1/2]

LicenseStatus Keyzy::KeyzyLicenseActivator::activateSemiOnline ( const std::string & serialNumber)

Downloads the license file from KEYZY service with given serial number, validate the license file and keep the license file and serial number in the device. If there is a license file or serial number in the device before, they will be overwriten. If the validation fails, it deletes the license file and the serial number from the device.

Parameters
std::stringserialNumber the license serial number

◆ activateSemiOnline() [2/2]

LicenseStatus Keyzy::KeyzyLicenseActivator::activateSemiOnline ( )

Downloads the license file from KEYZY service with the serial number which was kept before, validate the license file and keep it in the device If the validation fails, it deletes the license file and the serial number from the device.

Parameters
std::stringserialNumber the license serial number

◆ deactivateSemiOnline()

LicenseStatus Keyzy::KeyzyLicenseActivator::deactivateSemiOnline ( )

Checks if the device can reach KEYZY service. Delete the license file. Deactivate the license with KEYZY service.

◆ activateOffline()

LicenseStatus Keyzy::KeyzyLicenseActivator::activateOffline ( const std::string & licenseFilePath)

This is not a real activation, it doesn't connected to KEYZY service. Your user should download the license file on the internet first and that is the activation for KEYZY service. We strongly recommend to set Offline License Life for offline licenses in KEYZY app even they are perpetual licenses.

◆ deactivateOffline()

bool Keyzy::KeyzyLicenseActivator::deactivateOffline ( )

This is not a real deactivation, it doesn't connected to KEYZY service. Deletes the license file form the device only.

◆ activateClientTrial()

LicenseStatus Keyzy::KeyzyLicenseActivator::activateClientTrial ( const std::tm & endTime)

Creates a local (client-only) trial license stored on the device. The expiration is checked locally against the system clock.

For server-side trial licenses, obtain a trial serial either via LicenseDepositHandler::registerTrial() or from your own distribution channel (e.g. your website), then activate it using any of the standard methods: activateOnline(), activateSemiOnline() or activateOffline(). The same applies for validation and deactivation — server-side trials follow the same flow as perpetual and subscription licenses.

Parameters
endTimeDue date of trial license
Returns
LicenseStatus::VALID, LicenseStatus::EXPIRED, LicenseStatus::INVALID

◆ deactivateClientTrial()

bool Keyzy::KeyzyLicenseActivator::deactivateClientTrial ( )

Deletes local (client-only) trial license from the device. Does not affect server-side trial licenses.

Returns
true if it's success, false if it's failed.

◆ upgradeLicense() [1/2]

LicenseStatus Keyzy::KeyzyLicenseActivator::upgradeLicense ( const std::string & targetSerial)

Upgrade a license using the stored serial as the source. Reads the currently stored serial number from the device.

Note
This method only performs the upgrade on the KEYZY server. It does not activate or validate the new license, and does not store the target serial on the device. To activate the target serial afterward, use one of the activation methods (e.g. activateOnline, activateSemiOnline).
Parameters
targetSerialTarget serial number to upgrade to
Returns
LicenseStatus::VALID on success, LicenseStatus::CLIENT_SERIAL_DOES_NOT_EXIST if no source serial is stored

◆ upgradeLicense() [2/2]

LicenseStatus Keyzy::KeyzyLicenseActivator::upgradeLicense ( const std::string & sourceSerial,
const std::string & targetSerial )

Upgrade a license by providing both source and target serials explicitly.

Note
This method only performs the upgrade on the KEYZY server. It does not activate or validate the new license, and does not store the target serial on the device. To activate the target serial afterward, use one of the activation methods (e.g. activateOnline, activateSemiOnline).
Parameters
sourceSerialSource serial number (current license)
targetSerialTarget serial number to upgrade to
Returns
LicenseStatus