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::KeyzyLicenseValidator Class Reference

Validates licenses (online and offline) and exposes license fields (info, SKU, dealer, dates). More...

#include <KeyzyLicenseValidator.h>

Public Member Functions

 KeyzyLicenseValidator (std::shared_ptr< KeyzyLicenseProvider > licenseProvider)
LicenseStatus validateOnline () noexcept
LicenseStatus validateOffline () noexcept
LicenseStatus validateTrialLicense () noexcept
unsigned long long getDaysToExpireTrial ()
std::string getHostIdHash ()
std::string getHostIdHashLegacy ()
std::string getLicenseeName ()
std::string getLicenseeEmail ()
std::string getVersion ()
std::string getSku ()
std::string getLicenseType ()
LicenseType getLicenseTypeEnum ()
std::int64_t getStartTime ()
std::int64_t getEndTime ()
std::uint64_t getDaysLeft ()
std::uint64_t getDaysTotal ()
std::string getInfo ()
std::string getDealerName ()

Detailed Description

Validates licenses (online and offline) and exposes license fields (info, SKU, dealer, dates).

Constructor & Destructor Documentation

◆ KeyzyLicenseValidator()

Keyzy::KeyzyLicenseValidator::KeyzyLicenseValidator ( std::shared_ptr< KeyzyLicenseProvider > licenseProvider)

Create an instance of KeyzyLicenseValidator that will validate licenses for a product defined in ProductData structure

Parameters
productDataStructure that describes a product for which going to validate available licenses
licenseProvideris for not to create multiple object to prevent when update the license, update the provider

Member Function Documentation

◆ validateOnline()

LicenseStatus Keyzy::KeyzyLicenseValidator::validateOnline ( )
noexcept

Validate license online for product specified in KeyzyLicenseValidator constructor. Sends the stored serial number to the KEYZY server for validation. Works for all license types: perpetual, subscription and server-side trial.

Returns
License status

◆ validateOffline()

LicenseStatus Keyzy::KeyzyLicenseValidator::validateOffline ( )
noexcept

Validate license offline for product specified in KeyzyLicenseValidator constructor. Checks the locally stored encrypted license file without contacting the server. Works for all license types: perpetual, subscription and server-side trial.

Returns
License status

◆ validateTrialLicense()

LicenseStatus Keyzy::KeyzyLicenseValidator::validateTrialLicense ( )
noexcept

Validate a local (client-only) trial license. This method checks the trial due date stored locally on the device. It does NOT contact the KEYZY server.

For server-side trial licenses (registered via LicenseDepositHandler::registerTrial or distributed through your own channel), use validateOnline(), validateOffline() or activateSemiOnline() instead, as they follow the same flow as perpetual and subscription licenses.

Returns
LicenseStatus::VALID, LicenseStatus::EXPIRED or LicenseStatus::INVALID

◆ getDaysToExpireTrial()

unsigned long long Keyzy::KeyzyLicenseValidator::getDaysToExpireTrial ( )

Get days to expire a local (client-only) trial license. Not applicable for server-side trial licenses.

Returns
days to expire trial license or 0 if license has been expired

◆ getHostIdHash()

std::string Keyzy::KeyzyLicenseValidator::getHostIdHash ( )

Get host id hash

Returns
string with host id hash

◆ getHostIdHashLegacy()

std::string Keyzy::KeyzyLicenseValidator::getHostIdHashLegacy ( )

Get host id hash legacy

Returns
string with host id hash used before 0.0.13 version

◆ getLicenseeName()

std::string Keyzy::KeyzyLicenseValidator::getLicenseeName ( )

Get Licensee Name string

Returns
string with licensee's name

◆ getLicenseeEmail()

std::string Keyzy::KeyzyLicenseValidator::getLicenseeEmail ( )

Get Licensee Email string

Returns
string with licensee's email address

◆ getVersion()

std::string Keyzy::KeyzyLicenseValidator::getVersion ( )

Get version string

Returns
string with version string like "full version" or "lite version"

◆ getSku()

std::string Keyzy::KeyzyLicenseValidator::getSku ( )

Get sku string

Returns
string with sku

◆ getLicenseType()

std::string Keyzy::KeyzyLicenseValidator::getLicenseType ( )

Get license type string

Returns
string with license type

◆ getLicenseTypeEnum()

LicenseType Keyzy::KeyzyLicenseValidator::getLicenseTypeEnum ( )

Get license type enum

Returns
LicenseType enum

◆ getStartTime()

std::int64_t Keyzy::KeyzyLicenseValidator::getStartTime ( )

Get start time in Unix Timestamp Start time is eligble for only Subscription and Trial licenses it returns 315522000 default value if the license type is Perpetual

Returns
int64_t with start time

◆ getEndTime()

std::int64_t Keyzy::KeyzyLicenseValidator::getEndTime ( )

Get end time in Unix Timestamp End time represents end time for Subscription and Trial licenses If the license type is Perpetual, it represents Offline License Life If Offline License Life is set to 0 on KEYZY dashboard, it returns 315522000 as default value If Offline License Life is set to different than 0, it returns end time of the license

Returns
int64_t with end time

◆ getDaysLeft()

std::uint64_t Keyzy::KeyzyLicenseValidator::getDaysLeft ( )

Get how many days left in Unix Timestamp Days left represents how many days left to valid for Subscription and Trial licenses If the license type is Perpetual, it represents Offline License Life If Offline License Life is set to different than 0, it returns end time of the license

Returns
int64_t with days left

Don't use this function with Perpetual licenses

◆ getDaysTotal()

std::uint64_t Keyzy::KeyzyLicenseValidator::getDaysTotal ( )

Get total days in Unix Timestamp Days total represents total days for Subscription and Trial licenses If the license type is Perpetual, the value is garbage

Returns
int64_t with total days

Don't use this function with Perpetual licenses

◆ getInfo()

std::string Keyzy::KeyzyLicenseValidator::getInfo ( )

Get info string info represents a string which is a custom text. The software provider can customize each license with this info text.

Returns
string info

◆ getDealerName()

std::string Keyzy::KeyzyLicenseValidator::getDealerName ( )

Get dealer name string. For dealer-distributed licenses, returns the dealer's display name as configured in the partner dashboard. Empty string for non-dealer licenses. Populated by both validateOnline() and validateOffline().

Returns
string dealer name, or empty string when the license has no dealer