Implemented legacy public key signature

This commit is contained in:
FlorianMichael 2023-05-05 20:24:20 +02:00
parent 193b0c2735
commit d0debf1d94
4 changed files with 32 additions and 3 deletions

View File

@ -0,0 +1,8 @@
package de.florianmichael.viafabricplus.injection.access;
import java.nio.ByteBuffer;
public interface IKeyPairResponse {
ByteBuffer viafabricplus_getLegacyPublicKeySignature();
}

View File

@ -0,0 +1,20 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.authlib;
import com.google.gson.annotations.SerializedName;
import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
import de.florianmichael.viafabricplus.injection.access.IKeyPairResponse;
import org.spongepowered.asm.mixin.Mixin;
import java.nio.ByteBuffer;
@Mixin(KeyPairResponse.class)
public class MixinKeyPairResponse implements IKeyPairResponse {
@SerializedName("publicKeySignature")
private ByteBuffer viafabricplus_legacyKeySignature;
@Override
public ByteBuffer viafabricplus_getLegacyPublicKeySignature() {
return this.viafabricplus_legacyKeySignature;
}
}

View File

@ -18,6 +18,7 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft; package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
import com.mojang.authlib.yggdrasil.response.KeyPairResponse; import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
import de.florianmichael.viafabricplus.injection.access.IKeyPairResponse;
import de.florianmichael.viafabricplus.injection.access.IPublicKeyData; import de.florianmichael.viafabricplus.injection.access.IPublicKeyData;
import net.minecraft.client.util.ProfileKeysImpl; import net.minecraft.client.util.ProfileKeysImpl;
import net.minecraft.network.encryption.PlayerPublicKey; import net.minecraft.network.encryption.PlayerPublicKey;
@ -31,7 +32,6 @@ public class MixinProfileKeysImpl {
@Inject(method = "decodeKeyPairResponse", at = @At("RETURN")) @Inject(method = "decodeKeyPairResponse", at = @At("RETURN"))
private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) { private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) {
// ((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(keyPairResponse.getLegacyPublicKeySignature()); ((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(((IKeyPairResponse) keyPairResponse).viafabricplus_getLegacyPublicKeySignature());
// TODO | Track Key
} }
} }

View File

@ -158,7 +158,8 @@
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread", "fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
"jsonwebtoken.MixinClasses", "jsonwebtoken.MixinClasses",
"jsonwebtoken.MixinDefaultCompressionCodecResolver", "jsonwebtoken.MixinDefaultCompressionCodecResolver",
"jsonwebtoken.MixinDefaultJwtParserBuilder" "jsonwebtoken.MixinDefaultJwtParserBuilder",
"fixes.authlib.MixinKeyPairResponse"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1