feat: Android host adapter (android/truapi-host) + hosts/android submodule#289
Open
TarikGul wants to merge 8 commits into
Open
feat: Android host adapter (android/truapi-host) + hosts/android submodule#289TarikGul wants to merge 8 commits into
TarikGul wants to merge 8 commits into
Conversation
Add the android/truapi-host package (Kotlin host adapter shell over the truapi-server UniFFI core, localhost WebSocket bridge transport) matched to the current core FFI surface: HostCoreStorage, a single confirmUserAction, local signing session activation, and LocalhostBridgeBootstrap. Add Makefile targets uniffi-kotlin (Kotlin binding generation), android-jni (cargo-ndk cross-compile of libtruapi_server.so per ABI), and android-publish-local; gitignore the generated bindings and jniLibs.
- android-publish-local no longer depends on android-jni: the AAR does not bundle the cdylib, so publishing only needs the Kotlin bindings (JitPack has no NDK). - README: flag that the JitPack distribution is not yet wired up (no jitpack.yml at the repo root) and document the INTERNET permission the consuming app must declare.
…dule Mirror hosts/ios: vendor the Android app at hosts/android (tracking branch tg/truapi-rust-core) so the truapi repo can build and diagnose the app against its own core. .gitmodules uses the HTTPS URL to match hosts/ios; document the mobile host adapter packages and host submodules in the README layout.
Advance the submodule pin to include DefaultHostBridge + WebSocketChainProvider and the connected-session diagnostics test, so the vendored app builds and diagnoses against a working host.
Advance the hosts/android submodule to the hardened host bridge (deny-by-default confirmations, lifecycle/storage fixes) and add a check-android-parity make target that fails if the canonical android/truapi-host TrUAPIHost.kt shell drifts from the copy vendored in the app (hosts/android). The target skips cleanly when the submodule is not initialized, so it is safe to run in any checkout and to wire into CI.
Collaborator
|
will test it out One note before before I look into the code. I am a bit surprised that this work without some of the changes to the signing host that I pushed to |
Member
Author
|
@pgherveou Calrification: so signing did fail with the ring-vrf path which was expected but for sr25519 signing worked fine. I only used the signing host - no pairing at all. This is the list of pass fail: |
Member
Author
|
Holding this until #288 lands. Two things depend on it:
Once #288 is in the mobile base I'll wire |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Android TrUAPI host adapter
Brings Android to parity with the iOS host adapter (
ios/truapi-host): the truapi repo owns a Kotlin host-adapter package, and vendors the Android app as a submodule so the core can be built and diagnosed against it.What this adds
android/truapi-host/— the Kotlin host-adapter package over thetruapi-serverUniFFI core, the analogue ofios/truapi-host.TrUAPIHost.ktexposes the current FFI surface:HostBridge(device/remote permission split, a singleconfirmUserAction,chainConnect/Send/Close,lookupPreimage, theme, feature support),HostStorage+HostCoreStorage,TrUAPIHostCore(WS-bridge lifecycle, local-session activation, permission-authorization status, native change notifications), andLocalhostBridgeBootstrap. Products in a WebView reach the core over the localhost WebSocket bridge; the core signs on-device (signing-host role) with no separate phone.Build tooling (
Makefile):uniffi-kotlin(generate Kotlin bindings),android-jni(cargo-ndk cross-compile oflibtruapi_server.soper ABI), andandroid-publish-local.check-android-parityfails if the canonicalTrUAPIHost.ktshell drifts from the copy vendored in the app (skips cleanly when the submodule is uninitialized). Generated bindings andjniLibsare gitignored.hosts/androidsubmodule — vendorspolkadot-app-android-v2(branchtg/truapi-rust-core), mirroringhosts/ios..gitmodulesuses the HTTPS URL. Its app-side integration (abindings/truapi-hostrust-android module, a functionalDefaultHostBridge+WebSocketChainProvider, and an instrumented diagnostics harness) lives in that repo's companion PR.Verified on an Android emulator
The vendored app drives the host playground through the core end-to-end: the built-in Diagnosis sweep runs every TrUAPI method, with on-device signing/ permission approval prompts (no phone). All Signing methods pass and sign
locally; Account/Entropy/Local Storage/Notifications/Permissions pass. Remaining failures are funding/allowance-gated (Payment needs a balance; Preimage/Resource Allocation need on-chain allowances) or unimplemented on this host (Chat), consistent with the deployed-host diagnosis.
Notes
ios/truapi-host(no default-host/chain-provider helpers — those are app-side).TrUAPIHost.ktis duplicated between here and the vendored app copy;make check-android-parityguards against drift until it's single-sourced.jitpack.yml); local integration usesmake android-publish-local+mavenLocal(). Noted inandroid/truapi-host/README.md.