iw4x-client/src/Components/Modules/Auth.hpp

55 lines
1.4 KiB
C++
Raw Normal View History

2017-01-20 08:36:52 -05:00
#pragma once
2017-01-19 16:23:59 -05:00
namespace Components
{
class Auth : public Component
{
public:
Auth();
~Auth();
void preDestroy() override;
2017-01-20 08:36:52 -05:00
bool unitTest() override;
2017-01-19 16:23:59 -05:00
static void StoreKey();
static void LoadKey(bool force = false);
static void GenerateKey();
2017-01-19 16:23:59 -05:00
static unsigned __int64 GetKeyHash();
2018-12-17 08:29:18 -05:00
static unsigned __int64 GetKeyHash(const std::string& key);
2017-01-19 16:23:59 -05:00
static uint32_t GetSecurityLevel();
2018-12-17 08:29:18 -05:00
static void IncreaseSecurityLevel(uint32_t level, const std::string& command = "");
2017-01-19 16:23:59 -05:00
2018-12-17 08:29:18 -05:00
static uint32_t GetZeroBits(Utils::Cryptography::Token token, const std::string& publicKey);
static void IncrementToken(Utils::Cryptography::Token& token, Utils::Cryptography::Token& computeToken, const std::string& publicKey, uint32_t zeroBits, bool* cancel = nullptr, uint64_t* count = nullptr);
2017-01-19 16:23:59 -05:00
private:
class TokenIncrementing
{
public:
bool cancel;
bool generating;
std::thread thread;
uint32_t targetLevel;
int startTime;
std::string command;
uint64_t hashes;
};
static TokenIncrementing TokenContainer;
static Utils::Cryptography::Token GuidToken;
static Utils::Cryptography::Token ComputeToken;
static Utils::Cryptography::ECC::Key GuidKey;
2019-10-03 03:10:00 -04:00
static std::vector<std::uint64_t> BannedUids;
2017-01-19 16:23:59 -05:00
static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len);
2017-02-01 07:44:25 -05:00
static void ParseConnectData(Game::msg_t* msg, Game::netadr_t* addr);
2017-01-19 16:23:59 -05:00
static void DirectConnectStub();
static void Frame();
};
}