Signer

public final class Signer : Sendable

Utility class for creating signer keys used in multi-signature account configurations. Supports ED25519 public keys, SHA256 hashes, pre-authorized transactions, and signed payloads.

  • Creates an ED25519 public key signer from a key pair.

    Declaration

    Swift

    public static func ed25519PublicKey(keyPair: KeyPair) -> SignerKeyXDR

    Parameters

    keyPair

    The key pair containing the public key to use as a signer.

    Return Value

    A signer key representing the ED25519 public key.

  • Creates an ED25519 public key signer from an account ID.

    Declaration

    Swift

    public static func ed25519PublicKey(accountId: String) throws -> SignerKeyXDR

    Parameters

    accountId

    The Stellar account ID to use as a signer.

    Return Value

    A signer key representing the ED25519 public key.

  • Creates a SHA256 hash signer for hash-based authorization.

    Declaration

    Swift

    public static func sha256Hash(hash: Data) -> SignerKeyXDR

    Parameters

    hash

    The SHA256 hash value to use as a signer.

    Return Value

    A signer key representing the hash.

  • Creates a pre-authorized transaction signer that authorizes a specific transaction.

    Declaration

    Swift

    public static func preAuthTx(transaction: Transaction, network: Network) throws -> SignerKeyXDR

    Parameters

    transaction

    The transaction to pre-authorize.

    network

    The network on which the transaction will be submitted.

    Return Value

    A signer key representing the pre-authorized transaction hash.

  • Creates a signed payload signer that combines an account ID with custom payload data (CAP-40).

    Declaration

    Swift

    public static func signedPayload(accountId: String, payload: Data) throws -> SignerKeyXDR

    Parameters

    accountId

    The Stellar account ID to use as the signer.

    payload

    The custom payload data (max 64 bytes).

    Return Value

    A signer key representing the signed payload.