Class ImmutablePublicKey

java.lang.Object
org.xrpl.xrpl4j.crypto.core.keys.ImmutablePublicKey
All Implemented Interfaces:
PublicKey

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutablePublicKey extends Object implements PublicKey
Immutable implementation of PublicKey.

Use the builder to create immutable instances: ImmutablePublicKey.builder().

  • Method Details

    • value

      public UnsignedByteArray value()
      The key in binary (Note: will be 33 bytes).
      Specified by:
      value in interface PublicKey
      Returns:
      An instance of UnsignedByteArray.
    • base58Value

      public String base58Value()
      The public-key, as a base-58 encoded String.
      Specified by:
      base58Value in interface PublicKey
      Returns:
      A String.
    • base16Value

      public String base16Value()
      The private-key value, as a Base16-encoded (i.e., HEX) string. Note that if this is an Ed25519 private-key, then this value contains a leading prefix of `ED`, in hex.
      Specified by:
      base16Value in interface PublicKey
      Returns:
      A String.
    • versionType

      public VersionType versionType()
      The type of this key.
      Specified by:
      versionType in interface PublicKey
      Returns:
      A VersionType.
    • withValue

      public final ImmutablePublicKey withValue(UnsignedByteArray value)
      Copy the current immutable object by setting a value for the value attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for value
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutablePublicKey that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: value, base58Value, base16Value, versionType.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value PublicKey with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutablePublicKey copyOf(PublicKey instance)
      Creates an immutable copy of a PublicKey value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable PublicKey instance
    • builder

      public static ImmutablePublicKey.Builder builder()
      Creates a builder for ImmutablePublicKey.
       ImmutablePublicKey.builder()
          .value(org.xrpl.xrpl4j.codec.addresses.UnsignedByteArray) // required value
          .build();
       
      Returns:
      A new ImmutablePublicKey builder