Add decoded serial key into the request

This commit is contained in:
Serhii Hadzhilov 2022-07-15 16:17:17 +03:00
parent 8dff01bc24
commit 0e18c89416
6 changed files with 23 additions and 0 deletions

View File

@ -77,6 +77,7 @@ QByteArray LicenseRegistry::getRequestData() const
const SerialKey key(m_config.serialKey().toStdString());
data["email"] = key.getEmail().c_str();
data["key"] = key.toString().c_str();
data["key_decoded"] = key.getDecodedKey().c_str();
data["is_server"] = m_config.getServerGroupChecked();

View File

@ -161,3 +161,9 @@ SerialKey::getEmail() const
{
return m_data.email;
}
const std::string&
SerialKey::getDecodedKey() const
{
return m_data.key_decoded;
}

View File

@ -40,6 +40,7 @@ public:
const std::string& getEmail() const;
Edition edition() const;
const std::string& toString() const;
const std::string& getDecodedKey() const;
private:
SerialKeyData m_data;

View File

@ -26,6 +26,7 @@
*/
struct SerialKeyData {
std::string key; // Encoded serial key as a string
std::string key_decoded; // Decoded serial key
std::string email; // Email from the serial key
SerialKeyEdition edition; // Serial key edition
SerialKeyType keyType; // Serial key type

View File

@ -23,6 +23,12 @@ SerialKeyParser::setKey(const std::string& key)
m_data.key = key;
}
void
SerialKeyParser::setDecodedKey(const std::string& key)
{
m_data.key_decoded = key;
}
void
SerialKeyParser::setEmail(const std::string& email)
{
@ -97,11 +103,13 @@ SerialKeyParser::parse(const std::string& plainSerial)
if ((parts.size() == 8) && (parts.at(0).find("v1") != std::string::npos)) {
setKey(plainSerial);
setDecodedKey(key);
parseV1(parts);
valid = true;
}
else if ((parts.size() == 9) && (parts.at(0).find("v2") != std::string::npos)) {
setKey(plainSerial);
setDecodedKey(key);
parseV2(parts);
valid = true;
}

View File

@ -46,6 +46,12 @@ public:
*/
void setKey(const std::string& key);
/**
* @brief setKey setter to set decoded key
* @param key decoded serial key
*/
void setDecodedKey(const std::string& key);
/**
* @brief setEmail setter to set encoded email
* @param email encoded email from the key