# Mobile binding helpers

`LocalDecision.swift` and `LocalDecision.kt` are the complete helper functions shown in Portable Kernel. `evaluation.json` is a historical signed test vector, with the mobile field names and a fixed clock. It is not a live grant.

Generate bindings from the same public Chio source revision as the native library. The current interface uses UniFFI 0.32. Its signer requires `bodyJson`, `canonicalContentHex`, and `signingSeedHex`.

The Kotlin configuration uses UniFFI 0.32's global `[defaults]` format. It renames each error variant's `message` payload to `detail`, avoiding a collision with `Throwable.message`, and selects `chio_kernel_mobile` as the native library name. It does not change native field order or signatures.

From the public source checkout, with this exercise beside it and a matching `uniffi-bindgen`:

```sh
uniffi-bindgen generate crates/kernel/chio-kernel-mobile/src/chio_kernel_mobile.udl --language swift --out-dir bindings --no-format
uniffi-bindgen generate crates/kernel/chio-kernel-mobile/src/chio_kernel_mobile.udl --language kotlin --config ../architecture-lab/mobile/uniffi.toml --out-dir bindings --no-format
```

Link the generated Swift FFI module and matching native library. Kotlin's generated bridge requires JNA; the helper uses `org.json` (provided by Android, or a dependency on the JVM). Build the native library for the intended target rather than copying a macOS library onto a phone.

These helpers separate evaluation from signing. The signing body must contain the hash of the exact canonical content bytes supplied to the signer. A raw seed is not a hardware-backed key handle. Host compilation/execution does not qualify device custody, attestation, or an offline synchronization protocol.
