| KEYZY C++ Client Library 1.7.1 To develop software that is compiled with a C++ compiler and utilizes the KEYZY service (www.keyzy.io)

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Keyzy::KeyzyLicenseValidator Class Reference

`#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 ()

## Detailed Description

KeyzyLicenseValidator class should be used to validate licenses available on a client machine.

## 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

  productData | Structure that describes a product for which going to validate available licenses
  licenseProvider | is 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