Package net.minecraft.network.message
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 rrintermediary net/minecraft/class_7469named net/minecraft/network/message/MessageSignatureofficial aintermediary comp_798named senderofficial bintermediary comp_799named timestampofficial cintermediary comp_800named saltSignature
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NetworkEncryptionUtils.SignatureDataThe field for thesaltSignaturerecord component.private final UUIDThe field for thesenderrecord component.private final InstantThe field for thetimestamprecord component. -
Constructor Summary
ConstructorsConstructorDescriptionMessageSignature(UUID uUID, Instant instant, NetworkEncryptionUtils.SignatureData signatureData) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the signature can be verified.booleancanVerifyFrom(UUID expectedSender) Returns whether the message is fromexpectedSenderand the signature can be verified.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static MessageSignaturenone()Returns the value of thesaltSignaturerecord component.sender()Returns the value of thesenderrecord component.Returns the value of thetimestamprecord component.private static byte[]toByteArray(Text message) final StringtoString()Returns a string representation of this record class.static voidupdateSignature(SignatureUpdatable.SignatureUpdater updater, Text message, UUID sender, Instant time, long salt) Updatesupdaterwith the passed parameters.booleanverify(SignatureVerifier verifier, String message) Returns whethermessagecan be verified with this signature.booleanverify(SignatureVerifier verifier, Text message) Returns whethermessagecan be verified with this signature.
-
Field Details
-
sender
The field for thesenderrecord component. -
timestamp
The field for thetimestamprecord component. -
saltSignature
The field for thesaltSignaturerecord component.
-
-
Constructor Details
-
MessageSignature
public MessageSignature(UUID uUID, Instant instant, NetworkEncryptionUtils.SignatureData signatureData)
-
-
Method Details
-
none
- Mappings:
Namespace Name Mixin selector official aLrr;a()Lrr;intermediary method_43859Lnet/minecraft/class_7469;method_43859()Lnet/minecraft/class_7469;named noneLnet/minecraft/network/message/MessageSignature;none()Lnet/minecraft/network/message/MessageSignature;
-
verify
Returns whethermessagecan be verified with this signature.- Returns:
- whether
messagecan be verified with this signature - Mappings:
Namespace Name Mixin selector official aLrr;a(Lalw;Lrm;)Zintermediary method_43861Lnet/minecraft/class_7469;method_43861(Lnet/minecraft/class_7500;Lnet/minecraft/class_2561;)Znamed verifyLnet/minecraft/network/message/MessageSignature;verify(Lnet/minecraft/network/encryption/SignatureVerifier;Lnet/minecraft/text/Text;)Z
-
verify
Returns whethermessagecan be verified with this signature.- Parameters:
message- the message to verify- Returns:
- whether
messagecan be verified with this signature - Throws:
SignatureException- when verifying fails- Mappings:
Namespace Name Mixin selector official aLrr;a(Lalw;Ljava/lang/String;)Zintermediary method_43860Lnet/minecraft/class_7469;method_43860(Lnet/minecraft/class_7500;Ljava/lang/String;)Znamed verifyLnet/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 Updatesupdaterwith the passed parameters.- Throws:
SignatureException- when updating signature fails- See Also:
- Implementation Note:
- The data to be signed is
salt, followed by big-endian ordereduuid, followed bytimeas seconds from the UTC epoch, followed by UTF-8 encodedmessagebytes. - Mappings:
Namespace Name Mixin selector official aLrr;a(Lalv$a;Lrm;Ljava/util/UUID;Ljava/time/Instant;J)Vintermediary method_43862Lnet/minecraft/class_7469;method_43862(Lnet/minecraft/class_7498$class_7499;Lnet/minecraft/class_2561;Ljava/util/UUID;Ljava/time/Instant;J)Vnamed updateSignatureLnet/minecraft/network/message/MessageSignature;updateSignature(Lnet/minecraft/network/encryption/SignatureUpdatable$SignatureUpdater;Lnet/minecraft/text/Text;Ljava/util/UUID;Ljava/time/Instant;J)V
-
toByteArray
- Mappings:
Namespace Name Mixin selector official aLrr;a(Lrm;)[Bintermediary method_43863Lnet/minecraft/class_7469;method_43863(Lnet/minecraft/class_2561;)[Bnamed toByteArrayLnet/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 bLrr;b()Zintermediary method_44124Lnet/minecraft/class_7469;method_44124()Znamed canVerifyLnet/minecraft/network/message/MessageSignature;canVerify()Z
-
canVerifyFrom
Returns whether the message is fromexpectedSenderand 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
expectedSenderand the signature can be verified - Mappings:
Namespace Name Mixin selector official aLrr;a(Ljava/util/UUID;)Zintermediary method_44336Lnet/minecraft/class_7469;method_44336(Ljava/util/UUID;)Znamed canVerifyFromLnet/minecraft/network/message/MessageSignature;canVerifyFrom(Ljava/util/UUID;)Z
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
sender
Returns the value of thesenderrecord component.- Returns:
- the value of the
senderrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
saltSignature
Returns the value of thesaltSignaturerecord component.- Returns:
- the value of the
saltSignaturerecord component
-