OZExternalSignerManager

class OZExternalSignerManager(networkPassphrase: String, walletAdapter: ExternalWalletAdapter? = null, ed25519Adapter: OZExternalEd25519SignerAdapter? = null)

Manager for external (non-passkey) signers for multi-signature smart account operations.

OZExternalSignerManager provides a unified interface for managing Stellar account signers that originate from Ed25519 secret keys or external wallet connections (e.g., Freighter, LOBSTR). It supports two methods of adding signers:

  1. Keypair signers (via addFromSecret): Created from a raw Ed25519 secret key. These are held in memory only and are never persisted to storage. The secret key material is accessible only through the in-memory KeyPair instance.

  2. Wallet signers: Connected through an ExternalWalletAdapter. The adapter owns the connection lifecycle (e.g., WalletConnect sessions) and surfaces live connections via ExternalWalletAdapter.getConnectedWallets; the manager delegates signing to it.

Thread Safety: The in-memory signer registries are protected by a non-suspending platform lock so they can also be cleared from non-suspend teardown paths (OZSmartAccountKit.close). Public methods can be safely called from any coroutine context.

Example usage:

val manager = OZExternalSignerManager(
networkPassphrase = "Test SDF Network ; September 2015",
walletAdapter = myWalletAdapter
)

// Add from secret key (memory-only)
val address = manager.addFromSecret("SCZANGBA5YHT...")
println("Added keypair signer: $address")

// Check signing capability
if (manager.canSignFor("GABC...")) {
val result = manager.signAuthEntry("GABC...", preimageXdr)
println("Signed by: ${result.signerAddress}")
}

// List all signers
val signers = manager.getAll()

Parameters

networkPassphrase

The Stellar network passphrase used when delegating to wallet adapters.

walletAdapter

Optional wallet adapter backing the wallet (G-address) custody model. The SDK never sees the wallet's private key — signing is delegated out of process.

ed25519Adapter

Optional adapter backing the Ed25519 adapter custody model. When set, it is consulted via OZExternalEd25519SignerAdapter.canSignFor before the in-memory Ed25519 keypair registry (adapter-first precedence rule). Set a concrete OZExternalEd25519SignerAdapter to route Ed25519 signing through a hardware wallet, HSM, or remote signing service; leave null to use only in-memory keypairs registered via addEd25519FromRawKey.

Constructors

Link copied to clipboard
constructor(networkPassphrase: String, walletAdapter: ExternalWalletAdapter? = null, ed25519Adapter: OZExternalEd25519SignerAdapter? = null)

Properties

Link copied to clipboard

Whether an external wallet adapter is configured.

Functions

Link copied to clipboard
suspend fun addEd25519FromRawKey(secretKeyBytes: ByteArray, verifierAddress: String): ByteArray

Registers an Ed25519 signing keypair derived from raw 32-byte secret key material and stores it in memory under the composite (verifierAddress, publicKey) key. The keypair is never persisted to storage and is lost when the application terminates.

Link copied to clipboard
suspend fun addFromSecret(secretKey: String): String

Adds an Ed25519 keypair signer from a raw secret key.

Link copied to clipboard
fun canSignEd25519For(verifierAddress: String, publicKey: ByteArray): Boolean

Returns whether a signing source is available for the given Ed25519 signer.

Link copied to clipboard
suspend fun canSignFor(address: String): Boolean

Checks if any managed signer can sign for the given address.

Link copied to clipboard
suspend fun get(address: String): ExternalSignerInfo?

Gets information about a specific signer by address.

Link copied to clipboard

Lists all managed external signers (both keypair and wallet).

Link copied to clipboard
suspend fun hasSigners(): Boolean

Checks if any external signers are registered (keypair or wallet).

Link copied to clipboard
suspend fun remove(address: String)

Removes a signer by address.

Link copied to clipboard
suspend fun removeAll()

Removes all signers.

Link copied to clipboard
suspend fun removeEd25519(verifierAddress: String, publicKey: ByteArray)

Removes a registered Ed25519 signer from the in-memory registry.

Link copied to clipboard
suspend fun signAuthEntry(address: String, authEntry: String): SignAuthEntryResult

Signs an authorization entry preimage with the appropriate signer for the given address.

Link copied to clipboard
suspend fun signEd25519AuthDigest(verifierAddress: String, publicKey: ByteArray, authDigest: ByteArray): ByteArray

Produces a 64-byte Ed25519 signature over authDigest.