Cryptolens Client API for C++
Public Member Functions | Static Public Member Functions | List of all members
cryptolens_io::v20190401::LicenseKeyInformation Class Reference

#include <LicenseKeyInformation.hpp>

Public Member Functions

 LicenseKeyInformation (api::internal::main, int product_id, std::uint64_t created, std::uint64_t expires, int period, bool block, bool trial_activation, std::uint64_t sign_date, bool f1, bool f2, bool f3, bool f4, bool f5, bool f6, bool f7, bool f8, optional< int > id, optional< std::string > key, optional< std::string > notes, optional< int > global_id, optional< Customer > customer, optional< std::vector< ActivationData >> activated_machines, optional< int > maxnoofmachines, optional< std::string > allowed_machines, optional< std::vector< DataObject >> data_objects)
 
LicenseKeyChecker check () const
 
int get_product_id () const
 
std::uint64_t get_created () const
 
std::uint64_t get_expires () const
 
int get_period () const
 
bool get_block () const
 
bool get_trial_activation () const
 
std::uint64_t get_sign_date () const
 
bool get_f1 () const
 
bool get_f2 () const
 
bool get_f3 () const
 
bool get_f4 () const
 
bool get_f5 () const
 
bool get_f6 () const
 
bool get_f7 () const
 
bool get_f8 () const
 
optional< int > const & get_id () const
 
optional< std::string > const & get_key () const
 
optional< std::string > const & get_notes () const
 
optional< int > const & get_global_id () const
 
optional< Customer > const & get_customer () const
 
optional< std::vector< ActivationData > > const & get_activated_machines () const
 
optional< int > const & get_maxnoofmachines () const
 
optional< std::string > const & get_allowed_machines () const
 
optional< std::vector< DataObject > > const & get_data_objects () const
 

Static Public Member Functions

static optional< LicenseKeyInformationmake (basic_Error &e, RawLicenseKey const &raw_license_key)
 
static optional< LicenseKeyInformationmake (basic_Error &e, optional< RawLicenseKey > const &raw_license_key)
 
static optional< LicenseKeyInformationmake_unsafe (basic_Error &e, std::string const &license_key)
 

Detailed Description

This immutable class represents a license key.

The class is constructed using the static factory make().

The check() method can be used to create a LicenseKeyChecker, which can be used to check properties of a license key in a convenient fashion. I.e.

if (key.check().has_feature(1).has_not_feature(2)) {
  DO_SOMETHING();
}

Member Function Documentation

◆ check()

LicenseKeyChecker cryptolens_io::v20190401::LicenseKeyInformation::check ( ) const

Return a LicenseKeyChecker working on this LicenseKeyInformation object

◆ get_activated_machines()

optional< std::vector< ActivationData > > const & cryptolens_io::v20190401::LicenseKeyInformation::get_activated_machines ( ) const

Returns the list of activated machines

◆ get_allowed_machines()

optional< std::string > const & cryptolens_io::v20190401::LicenseKeyInformation::get_allowed_machines ( ) const

Returns the machine codes of those devices that will be prioritized during activation. Even if the limit is achieved, these will still be activated.

◆ get_block()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_block ( ) const

Returns if the license key is blocked

◆ get_created()

std::uint64_t cryptolens_io::v20190401::LicenseKeyInformation::get_created ( ) const

Returns the date and time the license key was created

◆ get_customer()

optional< Customer > const & cryptolens_io::v20190401::LicenseKeyInformation::get_customer ( ) const

Returns the customer object assigned to the license key

◆ get_data_objects()

optional< std::vector< DataObject > > const & cryptolens_io::v20190401::LicenseKeyInformation::get_data_objects ( ) const

Returns the data objects associated with the license key.

◆ get_expires()

std::uint64_t cryptolens_io::v20190401::LicenseKeyInformation::get_expires ( ) const

Returns the date and time the license key expires

◆ get_f1()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f1 ( ) const

Returns if the license key has feature 1

◆ get_f2()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f2 ( ) const

Returns if the license key has feature 2

◆ get_f3()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f3 ( ) const

Returns if the license key has feature 3

◆ get_f4()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f4 ( ) const

Returns if the license key has feature 4

◆ get_f5()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f5 ( ) const

Returns if the license key has feature 5

◆ get_f6()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f6 ( ) const

Returns if the license key has feature 6

◆ get_f7()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f7 ( ) const

Returns if the license key has feature 7

◆ get_f8()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_f8 ( ) const

Returns if the license key has feature 8

◆ get_global_id()

optional< int > const & cryptolens_io::v20190401::LicenseKeyInformation::get_global_id ( ) const

Returns a unique global identifier for the license key

◆ get_id()

optional< int > const & cryptolens_io::v20190401::LicenseKeyInformation::get_id ( ) const

Returns the Id of the license key

◆ get_key()

optional< std::string > const & cryptolens_io::v20190401::LicenseKeyInformation::get_key ( ) const

Return the license key string, eg. ABCDE-EFGHI-JKLMO-PQRST

◆ get_maxnoofmachines()

optional< int > const & cryptolens_io::v20190401::LicenseKeyInformation::get_maxnoofmachines ( ) const

Returns the maximum number of machines/devices that may activate this license key.

◆ get_notes()

optional< std::string > const & cryptolens_io::v20190401::LicenseKeyInformation::get_notes ( ) const

Returns the notes field of the license key

◆ get_period()

int cryptolens_io::v20190401::LicenseKeyInformation::get_period ( ) const

Returns the duration of current license cycle eg. 30 days

◆ get_product_id()

int cryptolens_io::v20190401::LicenseKeyInformation::get_product_id ( ) const

Returns the product Id of he license key

◆ get_sign_date()

std::uint64_t cryptolens_io::v20190401::LicenseKeyInformation::get_sign_date ( ) const

Returns the date the license key was created by the Web API

◆ get_trial_activation()

bool cryptolens_io::v20190401::LicenseKeyInformation::get_trial_activation ( ) const

Returns if trial activation is enabled

◆ make() [1/2]

optional< LicenseKeyInformation > cryptolens_io::v20190401::LicenseKeyInformation::make ( basic_Error e,
RawLicenseKey const &  raw_license_key 
)
static

Attempt to construct a LicenseKeyInformation from a RawLicenseKey

◆ make() [2/2]

optional< LicenseKeyInformation > cryptolens_io::v20190401::LicenseKeyInformation::make ( basic_Error e,
optional< RawLicenseKey > const &  raw_license_key 
)
static

Attempt to construct a LicenseKeyInformation from an optional containing a RawLicenseKey

◆ make_unsafe()

optional< LicenseKeyInformation > cryptolens_io::v20190401::LicenseKeyInformation::make_unsafe ( basic_Error e,
std::string const &  license_key 
)
static

Attempt to construct a LicenseKeyInformation from a json string

This is unsafe in the sense that by passing in the json string directly there is no check of the cryptographic signature. The signature verification is instead performed during construction of a RawLicenseKey object. A LicenseKeyInformation object can then be constructed from the RawLicenseKey using another static factory.


The documentation for this class was generated from the following files: