OZSmart Account Kit
Main orchestrator for OpenZeppelin Smart Account operations on Stellar/Soroban.
OZSmartAccountKit is the primary entry point for creating and managing smart accounts with WebAuthn/passkey authentication. It provides a high-level interface for:
Creating new smart account wallets with biometric authentication
Connecting to existing wallets via credential discovery
Managing wallet sessions and credentials
Submitting transactions with WebAuthn signatures
Interacting with signers, policies, and context rules
The kit orchestrates multiple components:
Storage adapter for credential persistence
Soroban RPC server for blockchain interaction
Relayer client for fee-sponsored transactions (optional)
Indexer client for credential-to-contract discovery (optional)
Example usage:
// Initialize the kit
val config = OZSmartAccountConfig(
rpcUrl = "https://soroban-testnet.stellar.org",
networkPassphrase = "Test SDF Network ; September 2015",
accountWasmHash = "abc123...",
webauthnVerifierAddress = "CBCD1234...",
relayerUrl = "https://relayer.example.com",
indexerUrl = "https://indexer.example.com"
)
val kit = OZSmartAccountKit.create(config)
// Create a new wallet (prompts for biometric authentication)
val wallet = kit.walletOperations.createWallet(userName = "My Wallet")
println("Created wallet: ${wallet.contractId}")
// Silent session check (returns null if no valid session)
val existing = kit.walletOperations.connectWallet()
if (existing != null) {
println("Connected to: ${existing.contractId}")
}
// Session check with WebAuthn fallback if no session
val connected = kit.walletOperations.connectWallet(
OZWalletOperations.ConnectWalletOptions(prompt = true)
)
println("Connected to: ${connected?.contractId}")
// Explicit connect with fresh WebAuthn prompt (skips session restore)
val fresh = kit.walletOperations.connectWallet(
OZWalletOperations.ConnectWalletOptions(fresh = true)
)
println("Authenticated and connected to: ${fresh?.contractId}")
// Disconnect
kit.disconnect()Thread Safety: This class is thread-safe. All internal state is protected by a Mutex. Public methods can be safely called from any coroutine context.
Properties
The configuration defining network endpoints, contract addresses, and operational parameters.
Manages context rule operations (creating, updating, removing rules).
The contract address of the currently connected wallet.
The credential ID of the currently connected wallet.
Manages credential operations (storing, retrieving, updating credentials).
Event emitter for wallet lifecycle events.
Optional indexer client for credential-to-contract discovery. Null when no indexer URL is configured.
Indicates whether a wallet is currently connected.
Manages multi-signer operations (coordinating multiple signers).
Manages policy operations (installing, removing, querying policies).
Optional relayer client for fee-sponsored transaction submission. Null when no relayer URL is configured.
Manages signer operations (adding, removing, querying signers).
Manages transaction operations (building, signing, submitting).
Manages wallet operations (creation, connection, disconnection).