Quickstart
mero-kotlin is the Android client for Calimero 1.0, the confidential cloud: apps run on
clusters of attested TDX nodes, and a client talks to them only after it has verified the node’s
quote, over a sealed channel. It mirrors mero-js ≥ 27’s CalimeroClient one to one.
1. Add the dependency
Section titled “1. Add the dependency”dependencies { implementation("network.calimero:mero-kotlin:<version>") // CalimeroClient, attestation, sealed transport implementation("network.calimero:mero-kotlin-compose:<version>") // MeroAppSession, PlatformPasskey, ConsentLauncher testImplementation("network.calimero:mero-kotlin-testkit:<version>") // InMemoryAppBackend}<version> is core’s release (the SDK ships with core). Before core’s release these were
network.calimero:mero-core and network.calimero:mero-compose; the Kotlin packages are unchanged.
2. A local cluster
Section titled “2. A local cluster”# in calimero-network/core, on Linux:cargo run -p merod -- local # three nodes on 127.0.0.1:2501-2503, --dev, mock attestation# on a Mac (merod 1.0 is Linux only), in a kotlin-sdk checkout, with Docker:scripts/dev-cluster.sh upFrom the Android emulator the host is 10.0.2.2, so the node is http://10.0.2.2:2501.
merod local signs a mock quote: a client must opt in with allowMock, and only ever for a
node you run.
3. Sign in and call
Section titled “3. Sign in and call”val client = CalimeroClient( CalimeroClientOptions( baseUrl = "http://10.0.2.2:2501", policy = CloudPolicy.development, // allowMock = true: merod local only onSession = sessionStore::save, // keep the newest session (refresh tokens are single-use) ),)
// A development cluster: a software passkey (keep it with export()/restore()).val passkey = SoftPasskey(rpId = "localhost", origin = "http://localhost:3000")client.signUp(passkey, "ada")
val appId = client.apps.create(name = "kv", `package` = "com.calimero.kv-store", initArgs = buildJsonObject {}).appIdclient.apps.intents(app = appId, method = "set", args = buildJsonObject { put("key", "a"); put("value", "1") })val value = client.apps.views(app = appId, method = "get", args = buildJsonObject { put("key", "a") }).resultclient.events(appId).collect { println("${it.kind}: ${it.data}") }Against a real cluster, trust real quotes only, and sign in with the device’s passkey:
val client = CalimeroClient(CalimeroClientOptions(baseUrl = clusterUrl, policy = CloudPolicy.production))client.signIn(PlatformPasskey(activity)) // Android Credential ManagerCloudPolicy.production is CloudReleasePolicy(DEFAULT_MIN_RELEASE): the node must name a
mero-tee release at or above 2.3.109, signed by the mero-tee release workflow, and its quote
must match that release’s locked-read-only image, with Intel’s collateral checked on the device.
A build people install from Google Play uses CloudPolicy.production. Only a separate staging
build (its own product flavor) uses CloudEnvironment.STAGING, which brings staging’s directory
and policy: any of staging’s three image profiles (CloudReleasePolicy.profiles, with
allowDebugProfile), the node’s own, whose signed image its quote must still be. A native app has
no hostname a browser checked, so the build decides, never what a person types or a server answers:
val cloud = if (BuildConfig.MERO_STAGING) CloudEnvironment.STAGING else CloudEnvironment.PRODUCTIONval client = CalimeroClient.connect(CalimeroConnectOptions(cluster, policy = cloud.policy(), directory = cloud.directory))4. A Compose app
Section titled “4. A Compose app”Most apps should not hold a client at all: MeroAppSession keeps the session, and its
MeroAppBackend is what screens use. See App session.