Record Class MessageSignature

java.lang.Object
java.lang.Record
net.minecraft.network.message.MessageSignature
Record Components:
sender -
timestamp -
saltSignature -

public record MessageSignature(UUID sender, Instant timestamp, NetworkEncryptionUtils.SignatureData saltSignature) extends Record
A signature for chat messages and message command arguments, consisting of the sender, the timestamp, and the signature data.
Mappings:
Namespace Name
official rr
intermediary net/minecraft/class_7469
named net/minecraft/network/message/MessageSignature
official a
intermediary comp_798
named sender
official b
intermediary comp_799
named timestamp
official c
intermediary comp_800
named saltSignature
  • Field Details

  • Constructor Details

  • Method Details

    • none

      public static MessageSignature none()
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a()Lrr;
      intermediary method_43859 Lnet/minecraft/class_7469;method_43859()Lnet/minecraft/class_7469;
      named none Lnet/minecraft/network/message/MessageSignature;none()Lnet/minecraft/network/message/MessageSignature;
    • verify

      public boolean verify(SignatureVerifier verifier, Text message)
      Returns whether message can be verified with this signature.
      Returns:
      whether message can be verified with this signature
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a(Lalw;Lrm;)Z
      intermediary method_43861 Lnet/minecraft/class_7469;method_43861(Lnet/minecraft/class_7500;Lnet/minecraft/class_2561;)Z
      named verify Lnet/minecraft/network/message/MessageSignature;verify(Lnet/minecraft/network/encryption/SignatureVerifier;Lnet/minecraft/text/Text;)Z
    • verify

      public boolean verify(SignatureVerifier verifier, String message) throws SignatureException
      Returns whether message can be verified with this signature.
      Parameters:
      message - the message to verify
      Returns:
      whether message can be verified with this signature
      Throws:
      SignatureException - when verifying fails
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a(Lalw;Ljava/lang/String;)Z
      intermediary method_43860 Lnet/minecraft/class_7469;method_43860(Lnet/minecraft/class_7500;Ljava/lang/String;)Z
      named verify Lnet/minecraft/network/message/MessageSignature;verify(Lnet/minecraft/network/encryption/SignatureVerifier;Ljava/lang/String;)Z
    • updateSignature

      public static void updateSignature(SignatureUpdatable.SignatureUpdater updater, Text message, UUID sender, Instant time, long salt) throws SignatureException
      Updates updater with the passed parameters.
      Throws:
      SignatureException - when updating signature fails
      See Also:
      Implementation Note:
      The data to be signed is salt, followed by big-endian ordered uuid, followed by time as seconds from the UTC epoch, followed by UTF-8 encoded message bytes.
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a(Lalv$a;Lrm;Ljava/util/UUID;Ljava/time/Instant;J)V
      intermediary method_43862 Lnet/minecraft/class_7469;method_43862(Lnet/minecraft/class_7498$class_7499;Lnet/minecraft/class_2561;Ljava/util/UUID;Ljava/time/Instant;J)V
      named updateSignature Lnet/minecraft/network/message/MessageSignature;updateSignature(Lnet/minecraft/network/encryption/SignatureUpdatable$SignatureUpdater;Lnet/minecraft/text/Text;Ljava/util/UUID;Ljava/time/Instant;J)V
    • toByteArray

      private static byte[] toByteArray(Text message)
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a(Lrm;)[B
      intermediary method_43863 Lnet/minecraft/class_7469;method_43863(Lnet/minecraft/class_2561;)[B
      named toByteArray Lnet/minecraft/network/message/MessageSignature;toByteArray(Lnet/minecraft/text/Text;)[B
    • canVerify

      public boolean canVerify()
      Returns whether the signature can be verified.

      Verifiable signature is not the same as verified signature. A signatures is verifiable if it has proper sender UUID and signature data. However, it can still fail to verify.

      Returns:
      whether the signature can be verified
      Mappings:
      Namespace Name Mixin selector
      official b Lrr;b()Z
      intermediary method_44124 Lnet/minecraft/class_7469;method_44124()Z
      named canVerify Lnet/minecraft/network/message/MessageSignature;canVerify()Z
    • canVerifyFrom

      public boolean canVerifyFrom(UUID expectedSender)
      Returns whether the message is from expectedSender and the signature can be verified.

      Verifiable signature is not the same as verified signature. A signatures is verifiable if it has proper sender UUID and signature data. However, it can still fail to verify.

      Returns:
      whether the message is from expectedSender and the signature can be verified
      Mappings:
      Namespace Name Mixin selector
      official a Lrr;a(Ljava/util/UUID;)Z
      intermediary method_44336 Lnet/minecraft/class_7469;method_44336(Ljava/util/UUID;)Z
      named canVerifyFrom Lnet/minecraft/network/message/MessageSignature;canVerifyFrom(Ljava/util/UUID;)Z
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • sender

      public UUID sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • saltSignature

      public NetworkEncryptionUtils.SignatureData saltSignature()
      Returns the value of the saltSignature record component.
      Returns:
      the value of the saltSignature record component