SignerKey

sealed class SignerKey

Represents a Stellar signer key used for transaction authorization.

This sealed class supports four types of signers as defined in the Stellar protocol:

  • ED25519 - Standard Ed25519 public key signer

  • PRE_AUTH_TX - Pre-authorized transaction hash signer

  • HASH_X - SHA-256 hash preimage signer (Hash-X)

  • ED25519_SIGNED_PAYLOAD - Ed25519 signed payload signer (CAP-40)

The Ed25519 Signed Payload Signer (introduced in CAP-40) is particularly useful for multi-party contracts like payment channels, as it allows all parties to share a set of transactions for signing and guarantees that if one transaction is signed and submitted, information is revealed that allows all other transactions in the set to be authorized.

Example usage:

// Create an Ed25519 signer
val ed25519Signer = SignerKey.ed25519PublicKey(publicKeyBytes)

// Create a signed payload signer
val payload = "transaction_hash".encodeToByteArray()
val payloadSigner = SignerKey.ed25519SignedPayload(publicKeyBytes, payload)

See also

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Ed25519PublicKey(val publicKey: ByteArray) : SignerKey

Ed25519 public key signer.

Link copied to clipboard
data class Ed25519SignedPayload(val ed25519PublicKey: ByteArray, val payload: ByteArray) : SignerKey

Ed25519 signed payload signer (CAP-40).

Link copied to clipboard
data class HashX(val hash: ByteArray) : SignerKey

SHA-256 hash preimage signer (Hash-X).

Link copied to clipboard
data class PreAuthTx(val hash: ByteArray) : SignerKey

Pre-authorized transaction hash signer.

Functions

Link copied to clipboard
abstract fun encodeSignerKey(): String

Gets the encoded string representation of this signer key.

Link copied to clipboard
abstract fun toXdr(): SignerKeyXdr

Converts this SignerKey to its XDR representation.