okHttpClient

fun TlsTrust.okHttpClient(base: OkHttpClient = OkHttpClient()): OkHttpClient

An OkHttpClient honouring the same trust anchors as the Ledger API channel, for the off-ledger REST APIs — ScanClient, ValidatorClient and TransferRegistryClient.

Pinning the ledger channel while these keep the platform trust store is a quiet asymmetry: balances, fee schedules and registry choice contexts would still arrive over an interceptable connection. Configure trust once and pass the result to all three.

val trust = TlsTrust(TlsTrust.TrustRoots.Certificates(listOf(operatorCa)))
val http = trust.okHttpClient()
val scan = ScanClient(scanUrl, http)

Returns base unchanged when the trust is the platform default.