![]() |
KEYZY C++ Client Library 1.10.2
To develop software that is compiled with a C++ compiler and utilizes the KEYZY service (www.keyzy.io)
|
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 () |
| HostIdMigrationResult | migrateHostIdV1toV2 (HostIdMigrationMode mode) |
| LicenseStatus | upgradeLicense (const std::string &targetSerial) |
| LicenseStatus | upgradeLicense (const std::string &sourceSerial, const std::string &targetSerial) |
| std::shared_ptr< KeyzyLicenseValidator > | getLicenseValidator () |
| std::shared_ptr< LicenseDepositHandler > | getLicenseDepositHandler () |
Activates and deactivates licenses — online, semi-online, offline, trial, and upgrade flows. The main entry point for most integrations.
| Keyzy::KeyzyLicenseActivator::KeyzyLicenseActivator | ( | const ProductData & | productData | ) |
Create an instance of KeyzyLicenseActivator that will activate / deactivate licenses for a product defined in ProductData structure
| productData | Structure that describes a product for which going to set/delete licenses |
| 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 only when the serial itself cannot be used (for example LicenseStatus::SERIAL_INVALID).
| LicenseStatus Keyzy::KeyzyLicenseActivator::deactivateOnline | ( | ) |
Deactivate the license with KEYZY service and delete the serial number from the device
| 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 activation fails, it deletes the license file and the serial number from the device only when the serial itself cannot be used (for example LicenseStatus::SERIAL_INVALID).
| std::string | serialNumber the license serial number |
| 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 activation fails, it deletes the license file and the serial number from the device only when the serial itself cannot be used (for example LicenseStatus::SERIAL_INVALID).
| std::string | serialNumber the license serial number |
| LicenseStatus Keyzy::KeyzyLicenseActivator::deactivateSemiOnline | ( | ) |
Checks if the device can reach KEYZY service. Delete the license file. Deactivate the license with KEYZY service.
| 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.
| 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.
| 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.
| endTime | Due date of trial license |
| bool Keyzy::KeyzyLicenseActivator::deactivateClientTrial | ( | ) |
Deletes local (client-only) trial license from the device. Does not affect server-side trial licenses.
| HostIdMigrationResult Keyzy::KeyzyLicenseActivator::migrateHostIdV1toV2 | ( | HostIdMigrationMode | mode | ) |
Moves a product released with HostIdScheme::V1 to HostIdScheme::V2 on the end user's device. Construct the activator with HostIdScheme::V2 (the default) and call this on every start, in place of the first step of your start-up flow. A V1 license moves to V2 without user input, also when its license file on the device has run out, as long as the serial is still stored.
Offline activation (activateOffline()) is not supported. Keep a product sold with offline licenses on HostIdScheme::V1, or send each user a new license file made for their V2 host id.
| mode | How the product activates its licenses. |
| 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.
| targetSerial | Target serial number to upgrade to |
| LicenseStatus Keyzy::KeyzyLicenseActivator::upgradeLicense | ( | const std::string & | sourceSerial, |
| const std::string & | targetSerial ) |
Upgrade a license by providing both source and target serials explicitly.
| sourceSerial | Source serial number (current license) |
| targetSerial | Target serial number to upgrade to |