OZSignerManager

Manager for smart account signer operations.

OZSignerManager provides high-level operations for managing signers on a smart account. It handles adding and removing different types of signers (passkeys, delegated accounts, Ed25519 keys) to context rules, with automatic validation and transaction building.

Signer types supported:

  • WebAuthn passkeys: secp256r1 signature verification via WebAuthn verifier contract

  • Delegated signers: Stellar accounts or contracts using built-in require_auth verification

  • Ed25519 signers: Traditional Ed25519 keys via Ed25519 verifier contract

Each context rule can have up to 15 signers. Signers are identified by their on-chain representation (address for delegated, verifier+key for external).

All state-changing methods accept an optional selectedSigners parameter for multi-signer authorization. When empty (default), the operation uses single-signer auth with the connected passkey. When non-empty, signatures are collected from all listed signers via OZMultiSignerManager.submitWithMultipleSigners.

Example usage:

val kit = OZSmartAccountKit.create(config)
val signerManager = kit.signerManager

// Add a passkey signer to the Default context rule (single-signer)
val result = signerManager.addPasskey(
contextRuleId = 0u,
publicKey = secp256r1PublicKey, // ByteArray, 65 bytes
credentialId = credentialIdBytes // ByteArray, raw WebAuthn credential ID
)
println("Signer added: ${result.success}")

// Add a delegated account signer (multi-signer)
val delegatedResult = signerManager.addDelegated(
contextRuleId = 0u,
address = "GA7QYNF7...",
selectedSigners = listOf(
SelectedSigner.Passkey(credentialId = cred1, credentialIdBytes = cred1Bytes, keyData = key1),
SelectedSigner.Wallet("GA7Q...")
)
)

Thread Safety: This class holds no mutable state. Thread safety of operations depends on the parent OZSmartAccountKit instance which synchronizes connection state via Mutex.

Functions

Link copied to clipboard
suspend fun addDelegated(contextRuleId: UInt, address: String, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): TransactionResult

Adds a delegated signer to a context rule.

Link copied to clipboard
suspend fun addEd25519(contextRuleId: UInt, verifierAddress: String, publicKey: ByteArray, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): TransactionResult

Adds an Ed25519 signer to a context rule.

Link copied to clipboard
suspend fun addNewPasskeySigner(contextRuleId: UInt, userName: String, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): AddPasskeySignerResult

Registers a new WebAuthn passkey and adds it as a signer to a context rule.

Link copied to clipboard
suspend fun addPasskey(contextRuleId: UInt, publicKey: ByteArray, credentialId: ByteArray, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): TransactionResult

Adds a WebAuthn passkey signer to a context rule.

Link copied to clipboard
suspend fun removeSigner(contextRuleId: UInt, signer: SmartAccountSigner, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): TransactionResult

Removes a signer from a context rule by matching the signer value.

suspend fun removeSigner(contextRuleId: UInt, signerId: UInt, selectedSigners: List<SelectedSigner> = emptyList(), forceMethod: SubmissionMethod? = null): TransactionResult

Removes a signer from a context rule by its ID.