8#if PROTOCOL_VERSION > 758
11#if PROTOCOL_VERSION > 759
15#if PROTOCOL_VERSION > 758
17typedef struct rsa_st
RSA;
46 bool JoinServer(
const std::string& server_id,
const std::vector<unsigned char>& shared_secret,
const std::vector<unsigned char>& server_public_key)
const;
51#if PROTOCOL_VERSION > 758
57#if PROTOCOL_VERSION == 759
63 std::vector<unsigned char>
GetMessageSignature(
const std::string& message,
long long int& salt,
long long int& timestamp);
64#elif PROTOCOL_VERSION == 760
73 const std::vector<unsigned char>& previous_signature,
const std::vector<ProtocolCraft::LastSeenMessagesEntry>& last_seen,
74 long long int& salt,
long long int& timestamp);
86 const std::vector<std::vector<unsigned char>>& last_seen,
87 long long int& salt,
long long int& timestamp);
113 std::string
GetMSAToken(
const std::optional<std::string>& cache_key)
const;
118 std::string
MSAAuthDeviceFlow(
const std::optional<std::string>& cache_key)
const;
123 std::string
GetXBLToken(
const std::string& msa_token)
const;
128 std::pair<std::string, std::string>
GetXSTSToken(
const std::string& xbl_token)
const;
135 bool GetMCToken(
const std::string& xsts_token,
const std::string& user_hash,
const std::optional<std::string>& cache_key);
140 bool GetMCProfile(
const std::optional<std::string>& cache_key);
142#if PROTOCOL_VERSION > 758
163 const std::string& content_type,
const std::string& accept,
164 const std::string& authorization,
const std::string& data)
const;
172 const std::string& authorization =
"")
const;
191#if PROTOCOL_VERSION > 758
bool GetPlayerCertificates()
Try to get player certificates using Minecraft token.
bool GetMCProfile(const std::optional< std::string > &cache_key)
Try to get Minecraft profile from Minecraft token.
bool JoinServer(const std::string &server_id, const std::vector< unsigned char > &shared_secret, const std::vector< unsigned char > &server_public_key) const
std::string GetXBLToken(const std::string &msa_token) const
Try to get XBox Live token from Microsoft token.
bool AuthMicrosoft(const std::string &cache_key)
Authentication using a Microsoft account, storing the credentials in the cache file.
const WebRequestResponse WebRequest(const std::string &host, const std::string &raw_request) const
Send a web request with ssl stuff.
ProtocolCraft::Json::Value GetAllCachedAccounts() const
Get the content of the whole cache file.
std::pair< std::string, std::string > GetXSTSToken(const std::string &xbl_token) const
Try to get XSTS token from XBL token.
std::string player_display_name
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
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.
bool GetMCToken(const std::string &xsts_token, const std::string &user_hash, const std::optional< std::string > &cache_key)
Try to get MC token from XSTS token and user hash.
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.
std::string GetMSAToken(const std::optional< std::string > &cache_key) const
Check if there is a saved credentials file and if the token is still valid.
const std::array< unsigned char, 16 > & GetPlayerUUID() const
RSA * GetPrivateKey() const
std::string mc_player_uuid
std::string key_signature
std::array< unsigned char, 16 > mc_player_uuid_bytes
std::string MSAAuthDeviceFlow(const std::optional< std::string > &cache_key) const
Try to authenticate with microsoft account using device flow.
const std::string & GetPublicKey() 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.
void WriteCacheFile(const ProtocolCraft::Json::Value &profiles) const
Save a profiles list to cache file.
ProtocolCraft::Json::Value GetCachedAccountOrDefault(const std::optional< std::string > &cache_key) const
Get the cached credentials for a key.
bool AuthMCToken(const std::string &mc_token)
Authentication using a minecraft token.
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