Class ProfileKeysImpl

java.lang.Object
net.minecraft.client.util.ProfileKeysImpl
All Implemented Interfaces:
ProfileKeys

@Environment(CLIENT) public class ProfileKeysImpl extends Object implements ProfileKeys
A class to fetch, load, and save the player's public and private keys.
Mappings:
Namespace Name
official fes
intermediary net/minecraft/class_7434
named net/minecraft/client/util/ProfileKeysImpl
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      official b Lfes;b:Lorg/slf4j/Logger;
      intermediary field_39074 Lnet/minecraft/class_7434;field_39074:Lorg/slf4j/Logger;
      named LOGGER Lnet/minecraft/client/util/ProfileKeysImpl;LOGGER:Lorg/slf4j/Logger;
    • TIME_UNTIL_FIRST_EXPIRY_CHECK

      private static final Duration TIME_UNTIL_FIRST_EXPIRY_CHECK
      Mappings:
      Namespace Name Mixin selector
      official c Lfes;c:Ljava/time/Duration;
      intermediary field_40797 Lnet/minecraft/class_7434;field_40797:Ljava/time/Duration;
      named TIME_UNTIL_FIRST_EXPIRY_CHECK Lnet/minecraft/client/util/ProfileKeysImpl;TIME_UNTIL_FIRST_EXPIRY_CHECK:Ljava/time/Duration;
    • PROFILE_KEYS_PATH

      private static final Path PROFILE_KEYS_PATH
      Mappings:
      Namespace Name Mixin selector
      official d Lfes;d:Ljava/nio/file/Path;
      intermediary field_39075 Lnet/minecraft/class_7434;field_39075:Ljava/nio/file/Path;
      named PROFILE_KEYS_PATH Lnet/minecraft/client/util/ProfileKeysImpl;PROFILE_KEYS_PATH:Ljava/nio/file/Path;
    • userApiService

      private final com.mojang.authlib.minecraft.UserApiService userApiService
      Mappings:
      Namespace Name Mixin selector
      official e Lfes;e:Lcom/mojang/authlib/minecraft/UserApiService;
      intermediary field_39958 Lnet/minecraft/class_7434;field_39958:Lcom/mojang/authlib/minecraft/UserApiService;
      named userApiService Lnet/minecraft/client/util/ProfileKeysImpl;userApiService:Lcom/mojang/authlib/minecraft/UserApiService;
    • jsonPath

      private final Path jsonPath
      Mappings:
      Namespace Name Mixin selector
      official f Lfes;f:Ljava/nio/file/Path;
      intermediary field_39076 Lnet/minecraft/class_7434;field_39076:Ljava/nio/file/Path;
      named jsonPath Lnet/minecraft/client/util/ProfileKeysImpl;jsonPath:Ljava/nio/file/Path;
    • keyFuture

      Mappings:
      Namespace Name Mixin selector
      official g Lfes;g:Ljava/util/concurrent/CompletableFuture;
      intermediary field_39959 Lnet/minecraft/class_7434;field_39959:Ljava/util/concurrent/CompletableFuture;
      named keyFuture Lnet/minecraft/client/util/ProfileKeysImpl;keyFuture:Ljava/util/concurrent/CompletableFuture;
    • expiryCheckTime

      private Instant expiryCheckTime
      Mappings:
      Namespace Name Mixin selector
      official h Lfes;h:Ljava/time/Instant;
      intermediary field_40798 Lnet/minecraft/class_7434;field_40798:Ljava/time/Instant;
      named expiryCheckTime Lnet/minecraft/client/util/ProfileKeysImpl;expiryCheckTime:Ljava/time/Instant;
  • Constructor Details

    • ProfileKeysImpl

      public ProfileKeysImpl(com.mojang.authlib.minecraft.UserApiService userApiService, UUID uuid, Path root)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lfes;<init>(Lcom/mojang/authlib/minecraft/UserApiService;Ljava/util/UUID;Ljava/nio/file/Path;)V
      intermediary <init> Lnet/minecraft/class_7434;<init>(Lcom/mojang/authlib/minecraft/UserApiService;Ljava/util/UUID;Ljava/nio/file/Path;)V
      named <init> Lnet/minecraft/client/util/ProfileKeysImpl;<init>(Lcom/mojang/authlib/minecraft/UserApiService;Ljava/util/UUID;Ljava/nio/file/Path;)V
  • Method Details

    • fetchKeyPair

      public CompletableFuture<Optional<PlayerKeyPair>> fetchKeyPair()
      Specified by:
      fetchKeyPair in interface ProfileKeys
      Mappings:
      Namespace Name Mixin selector
      official a Lffc;a()Ljava/util/concurrent/CompletableFuture;
      intermediary method_46522 Lnet/minecraft/class_7853;method_46522()Ljava/util/concurrent/CompletableFuture;
      named fetchKeyPair Lnet/minecraft/client/util/ProfileKeys;fetchKeyPair()Ljava/util/concurrent/CompletableFuture;
    • isExpired

      public boolean isExpired()
      Specified by:
      isExpired in interface ProfileKeys
      Mappings:
      Namespace Name Mixin selector
      official b Lffc;b()Z
      intermediary method_46523 Lnet/minecraft/class_7853;method_46523()Z
      named isExpired Lnet/minecraft/client/util/ProfileKeys;isExpired()Z
    • getKeyPair

      private CompletableFuture<Optional<PlayerKeyPair>> getKeyPair(Optional<PlayerKeyPair> currentKey)
      Gets the key pair from the file cache, or if it is unavailable or expired, the Mojang server.
      Mappings:
      Namespace Name Mixin selector
      official a Lfes;a(Ljava/util/Optional;)Ljava/util/concurrent/CompletableFuture;
      intermediary method_43602 Lnet/minecraft/class_7434;method_43602(Ljava/util/Optional;)Ljava/util/concurrent/CompletableFuture;
      named getKeyPair Lnet/minecraft/client/util/ProfileKeysImpl;getKeyPair(Ljava/util/Optional;)Ljava/util/concurrent/CompletableFuture;
    • loadKeyPairFromFile

      private Optional<PlayerKeyPair> loadKeyPairFromFile()
      Returns the profile keys from the local cache.

      This can return expired keys.

      Returns:
      the profile keys from the local cache
      Implementation Note:
      The cache file is stored at .minecraft/profilekeys/<uuid>.json.
      Mappings:
      Namespace Name Mixin selector
      official c Lfes;c()Ljava/util/Optional;
      intermediary method_43606 Lnet/minecraft/class_7434;method_43606()Ljava/util/Optional;
      named loadKeyPairFromFile Lnet/minecraft/client/util/ProfileKeysImpl;loadKeyPairFromFile()Ljava/util/Optional;
    • saveKeyPairToFile

      private void saveKeyPairToFile(@Nullable @Nullable PlayerKeyPair keyPair)
      Saves the keyPair to the cache file if SharedConstants.isDevelopment is true; otherwise, just deletes the cache file.
      Mappings:
      Namespace Name Mixin selector
      official a Lfes;a(Lbyq;)V
      intermediary method_43600 Lnet/minecraft/class_7434;method_43600(Lnet/minecraft/class_7427;)V
      named saveKeyPairToFile Lnet/minecraft/client/util/ProfileKeysImpl;saveKeyPairToFile(Lnet/minecraft/network/encryption/PlayerKeyPair;)V
    • fetchKeyPair

      private PlayerKeyPair fetchKeyPair(com.mojang.authlib.minecraft.UserApiService userApiService) throws NetworkEncryptionException, IOException
      Returns the key pair fetched from Mojang's server.
      Returns:
      the key pair fetched from Mojang's server
      Throws:
      NetworkEncryptionException - when the fetched key is malformed
      IOException - when fetching fails
      Mappings:
      Namespace Name Mixin selector
      official a Lfes;a(Lcom/mojang/authlib/minecraft/UserApiService;)Lbyq;
      intermediary method_43605 Lnet/minecraft/class_7434;method_43605(Lcom/mojang/authlib/minecraft/UserApiService;)Lnet/minecraft/class_7427;
      named fetchKeyPair Lnet/minecraft/client/util/ProfileKeysImpl;fetchKeyPair(Lcom/mojang/authlib/minecraft/UserApiService;)Lnet/minecraft/network/encryption/PlayerKeyPair;
    • decodeKeyPairResponse

      private static PlayerPublicKey.PublicKeyData decodeKeyPairResponse(com.mojang.authlib.yggdrasil.response.KeyPairResponse keyPairResponse) throws NetworkEncryptionException
      Returns keyPairResponse decoded to PlayerPublicKey.PublicKeyData.
      Returns:
      keyPairResponse decoded to PlayerPublicKey.PublicKeyData
      Throws:
      NetworkEncryptionException - when the response is malformed
      Mappings:
      Namespace Name Mixin selector
      official a Lfes;a(Lcom/mojang/authlib/yggdrasil/response/KeyPairResponse;)Lbyr$a;
      intermediary method_44076 Lnet/minecraft/class_7434;method_44076(Lcom/mojang/authlib/yggdrasil/response/KeyPairResponse;)Lnet/minecraft/class_7428$class_7443;
      named decodeKeyPairResponse Lnet/minecraft/client/util/ProfileKeysImpl;decodeKeyPairResponse(Lcom/mojang/authlib/yggdrasil/response/KeyPairResponse;)Lnet/minecraft/network/encryption/PlayerPublicKey$PublicKeyData;