Skip to content

iOS host integration - #330

Open
ERussel wants to merge 36 commits into
mainfrom
rus-ios-integration
Open

iOS host integration#330
ERussel wants to merge 36 commits into
mainfrom
rus-ios-integration

Conversation

@ERussel

@ERussel ERussel commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • HostCallbacks UI-decision callbacks (navigateTo, pushNotification, devicePermission, remotePermission, featureSupported, confirmUserAction, lookupPreimage) are async and awaited by the core — hosts suspend for as long as the user takes, dropping the future cancels the prompt, and other TrUAPI traffic keeps flowing meanwhile.
  • Host callbacks and NativeTrUApiCore functions take typed values instead of SCALE-encoded bytes: NativeDevicePermission, NativeRemotePermission, PushNotificationRequest, FeatureSupportedRequest, a full-fidelity NativeUserConfirmationReview tree, and a typed NativePermissionAuthorizationRequest on the permission admin API. Exhaustive From conversions make drift from the canonical types a compile error; embedders no longer hand-roll SCALE decoders.
  • Core-storage keys stay SCALE bytes by design — opaque, identity-bearing storage indexes hosts never introspect.
  • TrUAPIHost is a resolvable SPM package (root Package.swift): generated bindings and the bundled TS lockdown container are committed; the xcframework ships as a GitHub release asset, with a useLocalBinary toggle for local development.
  • ios/truapi-host/scripts/rebuild.sh regenerates the xcframework, uniffi bindings, and container bundle in place; scripts/publish.sh <version> uploads the xcframework to the @parity/ios-host@<version> release and updates the manifest URL + checksum.

pgherveou and others added 30 commits July 17, 2026 19:07
Use codec-derived runtime payloads and metadata-aware storage projections so field ordering and variant encoding stay aligned with chain types. Derive SSO message labels once and keep normal transcript events at debug.
Native executors need dispatch futures that can move across Tokio worker
threads. Keep concise async signatures while teaching rustdoc codegen to
unwrap async-trait futures.
@ERussel
ERussel requested a review from a team August 4, 2026 00:08
@ERussel ERussel changed the title iOS host integration: async typed host callbacks and SPM packaging iOS host integration Aug 4, 2026

@pgherveou pgherveou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks,

some early comments, will dig into it more and test

Comment thread ios/truapi-host/container/src/index.ts Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this packages should probably live under js/packages this will I assume probably be shared with android hosts as well

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this if we have truapi-host-container ?

@ERussel ERussel Aug 4, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There reason is that we want to distribute the target script. iOS host sdk moved here https://github.com/paritytech/truapi-ios due to package distribution failure from truapi repo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just reuse the existing struct rather than mirroring them?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue is that uniffi can't represent all the types from UserConfirmationReview. For example, fixed size arrays. I thought that that was the reason why initialy the core interface was based on scale payloads but in the end of the day i decided to put the mirror in rust rather than duplicating it on both platforms

@pgherveou

Copy link
Copy Markdown
Collaborator

HostCallbacks UI-decision callbacks (navigateTo, pushNotification, devicePermission, remotePermission, featureSupported, confirmUserAction, lookupPreimage) are async and awaited by the core — hosts suspend for as long as the user takes, dropping the future cancels the prompt, and other TrUAPI traffic keeps flowing meanwhile.

That's good I think the previous implementation was an artifact of following the web/wasm implementation where we built typed api re-using scale instead of wasm bindgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants