Fix bug: Yggdrasil client can't send message upper 22w17a

When try to send message in yggdrasil-auth server with `enforce-secure-profile=true`
and `online-mode=true` enabled, will fail with message in red:
Chat disabled due to missing profile public key. Please try reconnecting.
So yggdrasil-auth-client also has to encrypt chat messages like Microsoft-auth-client
to send out messages.
This commit is contained in:
oldkingOK 2024-01-13 03:00:02 +08:00
parent 22cf7a046b
commit 2c8b15b02e
2 changed files with 46 additions and 13 deletions

View file

@ -557,7 +557,7 @@ namespace MinecraftClient
}
}
if (Config.Main.General.AccountType == LoginType.microsoft
if ((Config.Main.General.AccountType == LoginType.microsoft || Config.Main.General.AccountType == LoginType.yggdrasil)
&& (InternalConfig.Account.Password != "-" || Config.Main.General.Method == LoginMethod.browser)
&& Config.Signature.LoginWithSecureProfile
&& protocolversion >= 759 /* 1.19 and above */)
@ -582,7 +582,7 @@ namespace MinecraftClient
if (playerKeyPair == null || playerKeyPair.NeedRefresh())
{
ConsoleIO.WriteLineFormatted(Translations.mcc_fetching_key, acceptnewlines: true);
playerKeyPair = KeyUtils.GetNewProfileKeys(session.ID);
playerKeyPair = KeyUtils.GetNewProfileKeys(session.ID, Config.Main.General.AccountType == LoginType.yggdrasil);
if (Config.Main.Advanced.ProfileKeyCache != CacheType.none && playerKeyPair != null)
{
KeysCache.Store(loginLower, playerKeyPair);