Contents
Record Class IceCredentials
java.lang.Object
java.lang.Record
com.hypixel.hytale.server.core.io.ice.IceCredentials
Short-term credentials for one peer's connectivity checks.
The direction of USERNAME and the choice of key decide whether two independent implementations
interoperate at all, so both are settled here rather than at each call site. A request carries
peer-ufrag:local-ufrag and is keyed with the peer's password. A response carries no
USERNAME and is keyed with the responder's own password.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionIceCredentials(String ufrag, String password) Creates an instance of aIceCredentialsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuildUsernameFor(String peerUfrag) Builds the USERNAME for a check sent to the peer owningpeerUfrag.final booleanIndicates whether some other object is "equal to" this one.static IceCredentialsgenerate()Mints credentials for one peer.final inthashCode()Returns a hash code value for this object.byte[]The HMAC key for short-term credentials, which is the password with no derivation applied.static booleanstatic StringparseLocalUfrag(String username) Extracts the local ufrag from a received USERNAME, which identifies the agent the check is for.password()Returns the value of thepasswordrecord component.final StringtoString()Returns a string representation of this record class.ufrag()Returns the value of theufragrecord component.
-
Field Details
-
MIN_UFRAG_LENGTH
public static final int MIN_UFRAG_LENGTH- See Also:
-
MAX_UFRAG_LENGTH
public static final int MAX_UFRAG_LENGTH- See Also:
-
MIN_PASSWORD_LENGTH
public static final int MIN_PASSWORD_LENGTH- See Also:
-
MAX_PASSWORD_LENGTH
public static final int MAX_PASSWORD_LENGTH- See Also:
-
-
Constructor Details
-
IceCredentials
-
-
Method Details
-
generate
Mints credentials for one peer. Every joiner gets its own ufrag, which is how a listener serving several peers routes an inbound check to the right agent. -
isValid
-
buildUsernameFor
-
parseLocalUfrag
-
integrityKey
public byte[] integrityKey()The HMAC key for short-term credentials, which is the password with no derivation applied.RFC 5389 section 15.4 (MESSAGE-INTEGRITY), or section 14.5 of RFC 8489 which obsoletes it, gives
key = SASLprep(password). An ice-char password contains no character SASLprep would alter, so the raw bytes are the key. -
toString
-
hashCode
-
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). -
ufrag
Returns the value of theufragrecord component.- Returns:
- the value of the
ufragrecord component
-
password
Returns the value of thepasswordrecord component.- Returns:
- the value of the
passwordrecord component
-