Class SignerKey.Ed25519SignedPayload

java.lang.Object
org.stellar.sdk.SignerKey.Ed25519SignedPayload
Enclosing class:
SignerKey

public static final class SignerKey.Ed25519SignedPayload extends Object
Represents an Ed25519 signed payload as defined in CAP-40.

An Ed25519 signed payload consists of an Ed25519 public key and a payload of up to 64 bytes. The signature for this signer type is produced by Ed25519 signing the payload with the private key that corresponds to the public key.

This signer type is particularly useful for multi-party contracts such as payment channels, where it allows all parties to share signatures for a set of transactions while ensuring that signing one transaction reveals the information needed to authorize related transactions.

The signature hint for this signer type is calculated as the XOR of the last 4 bytes of the Ed25519 public key and the last 4 bytes of the payload (padded with zeros if the payload is less than 4 bytes).

See Also:
  • Constructor Details

    • Ed25519SignedPayload

      public Ed25519SignedPayload(byte[] ed25519PublicKey, byte[] payload)
      Creates a new Ed25519SignedPayload.
      Parameters:
      ed25519PublicKey - The 32-byte Ed25519 public key
      payload - The payload to be signed (1-64 bytes)
      Throws:
      IllegalArgumentException - if the payload length is not between 1 and 64
  • Method Details

    • getEncodedEd25519PublicKey

      public String getEncodedEd25519PublicKey()
      Gets the StrKey-encoded representation of the Ed25519 public key.
      Returns:
      The StrKey-encoded Ed25519 public key (starts with 'G')
    • getEd25519PublicKey

      public byte[] getEd25519PublicKey()
      The Ed25519 public key (32 bytes) that must sign the payload.
      Returns:
      the Ed25519 public key bytes
    • getPayload

      public byte[] getPayload()
      The payload to be signed (up to 64 bytes).
      Returns:
      the payload bytes
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object