7#if PROTOCOL_VERSION > 758
10#if PROTOCOL_VERSION > 759
36 const bool JoinServer(
const std::string& server_id,
const std::vector<unsigned char>& shared_secret,
const std::vector<unsigned char>&
public_key)
const;
41#if PROTOCOL_VERSION > 758
47#if PROTOCOL_VERSION == 759
54 long long int& salt,
long long int& timestamp);
55#elif PROTOCOL_VERSION == 760
64 const std::vector<unsigned char>& previous_signature,
const std::vector<ProtocolCraft::LastSeenMessagesEntry>& last_seen,
65 long long int& salt,
long long int& timestamp);
77 const std::vector<std::vector<unsigned char>>& last_seen,
78 long long int& salt,
long long int& timestamp);
116 void UpdateCachedMSA(
const std::string& login,
const std::string& access_token,
117 const std::string& refresh_token,
const long long int& expiration)
const;
124 const long long int& expiration)
const;
131 const std::string&
id)
const;
133#if PROTOCOL_VERSION > 758
142 const std::string& public_k,
const std::string& signature_v1,
143 const std::string& signature_v2,
const long long int& expiration)
const;
151 const std::string
GetMSAToken(
const std::string& login)
const;
161 const std::string
GetXBLToken(
const std::string& msa_token)
const;
166 const std::pair<std::string, std::string>
GetXSTSToken(
const std::string& xbl_token)
const;
173 const std::string
GetMCToken(
const std::string& login,
174 const std::string& xsts_token,
const std::string& user_hash)
const;
180 const std::pair<std::string, std::string>
GetMCProfile(
const std::string& login,
181 const std::string& mc_token)
const;
183#if PROTOCOL_VERSION > 758
188 const std::tuple<std::string, std::string, std::string, long long int>
GetPlayerCertificates(
const std::string& login,
189 const std::string& mc_token)
const;
207 const std::string& content_type,
const std::string& accept,
208 const std::string& authorization,
const std::string& data)
const;
216 const std::string& authorization =
"")
const;
235#if PROTOCOL_VERSION > 758
ProtocolCraft::Json::Value GetCachedProfiles() const
Get the content of the whole cache file.
const std::string & GetPrivateKey() const
ProtocolCraft::Json::Value GetCachedCredentials(const std::string &login) const
Try to find a cached account corresponding to login.
void UpdateCachedMCProfile(const std::string &login, const std::string &name, const std::string &id) const
Update the cached MC profile data for the given login.
const WebRequestResponse WebRequest(const std::string &host, const std::string &raw_request) const
Send a web request with ssl stuff.
const std::string GetXBLToken(const std::string &msa_token) const
Try to get XBox Live token from Microsoft token.
std::string player_display_name
const std::string MSAAuthDeviceFlow(const std::string &login) const
Try to authenticate with microsoft account using device flow.
const bool IsTokenExpired(const long long int &t) const
Check if a validity time is in the present or in the future.
const std::string GetMSAToken(const std::string &login) const
Check if there is a saved credentials file and if the token is still valid.
static const std::string cached_credentials_path
Path to cache the credentials.
static const std::string botcraft_app_id
Botcraft app ID for microsoft auth.
const std::string & GetPlayerDisplayName() const
long long int key_timestamp
void UpdateUUIDBytes()
Compute the UUID bytes from the string one.
std::string mc_access_token
const bool AuthMicrosoft(const std::string &login)
Authentication using a Microsoft account.
static const ProtocolCraft::Json::Value defaultCachedCredentials
Default cached credentials JSON.
const WebRequestResponse POSTRequest(const std::string &host, const std::string &endpoint, const std::string &content_type, const std::string &accept, const std::string &authorization, const std::string &data) const
Send a POST request with ssl stuff.
const std::vector< unsigned char > GetMessageSignature(const std::string &message, const int message_sent_index, const ProtocolCraft::UUID &chat_session_uuid, const std::vector< std::vector< unsigned char > > &last_seen, long long int &salt, long long int ×tamp)
Compute the signature of a message.
const std::tuple< std::string, std::string, std::string, long long int > GetPlayerCertificates(const std::string &login, const std::string &mc_token) const
Try to get player certificates from Minecraft token.
const std::string & GetKeySignature() const
const long long int GetKeyTimestamp() const
const WebRequestResponse GETRequest(const std::string &host, const std::string &endpoint, const std::string &authorization="") const
Send a GET request with ssl stuff.
const std::string GetMCToken(const std::string &login, const std::string &xsts_token, const std::string &user_hash) const
Try to get MC token from XSTS token and user hash.
const std::pair< std::string, std::string > GetXSTSToken(const std::string &xbl_token) const
Try to get XSTS token from XBL token.
const std::array< unsigned char, 16 > & GetPlayerUUID() const
const std::tuple< std::string, std::string, std::string > ExtractMCFromResponse(const ProtocolCraft::Json::Value &response) const
Extract the token, the name and the uuid from a server response.
std::string mc_player_uuid
std::string key_signature
std::array< unsigned char, 16 > mc_player_uuid_bytes
const std::string & GetPublicKey() const
void WriteCacheFile(const ProtocolCraft::Json::Value &profiles) const
Save a profiles list to cache file.
void UpdateCachedMCToken(const std::string &login, const std::string &mc_token, const long long int &expiration) const
Update the cached MC token data for the given login.
const bool JoinServer(const std::string &server_id, const std::vector< unsigned char > &shared_secret, const std::vector< unsigned char > &public_key) const
void UpdateCachedPlayerCertificates(const std::string &login, const std::string &private_k, const std::string &public_k, const std::string &signature_v1, const std::string &signature_v2, const long long int &expiration) const
Update the cached player certificates for the given login.
const std::pair< std::string, std::string > GetMCProfile(const std::string &login, const std::string &mc_token) const
Try to get Minecraft profile from Minecraft token.
void UpdateCachedMSA(const std::string &login, const std::string &access_token, const std::string &refresh_token, const long long int &expiration) const
Update the cached MSA data for the given login.
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
std::array< unsigned char, 16 > UUID
ProtocolCraft::Json::Value response
std::string status_message