createClient

suspend fun createClient(logger: FfiLogger, host: String, isSecure: Boolean, db: String?, encryptionKey: ByteArray?, inboxId: String, accountAddress: String, nonce: ULong, legacySignedPrivateKeyProto: ByteArray?, historySyncUrl: String?): FfiXmtpClient

It returns a new client of the specified inbox_id. Note that the inbox_id must be either brand new or already associated with the account_address. i.e. inbox_id cannot be associated with another account address.

Prior to calling this function, it's suggested to form inbox_id, account_address, and nonce like below.

inbox_id = get_inbox_id_for_address(account_address)
nonce = 0

// if inbox_id is not associated, we will create new one.
if !inbox_id {
if !legacy_key { nonce = random_u64() }
inbox_id = generate_inbox_id(account_address, nonce)
} // Otherwise, we will just use the inbox and ignore the nonce.
db_path = $inbox_id-$env

xmtp.create_client(account_address, nonce, inbox_id, Option<legacy_signed_private_key_proto>)