refactored session checks for better readability

This commit is contained in:
mcflurrybaby 2023-12-02 13:15:46 +02:00
parent ceff78a821
commit e19de8eb0b
4 changed files with 9 additions and 21 deletions

View file

@ -39,10 +39,7 @@ namespace MinecraftClient.Protocol.Session
return false;
Crypto.CryptoHandler.ClientAESPrivateKey ??= Crypto.CryptoHandler.GenerateAESPrivateKey();
string serverHash = Crypto.CryptoHandler.GetServerHash(ServerIDhash, ServerPublicKey, Crypto.CryptoHandler.ClientAESPrivateKey);
bool notYggdrasil = type == LoginType.mojang || type == LoginType.microsoft;
if (notYggdrasil && ProtocolHandler.SessionCheck(PlayerID, ID, serverHash))
return true;
if (type == LoginType.yggdrasil && ProtocolHandler.YggdrasilSessionCheck(PlayerID, ID, serverHash))
if (ProtocolHandler.SessionCheck(PlayerID, ID, serverHash, type))
return true;
return false;
}