Skip to content

SSO message handling bindings for Mobile hosts - #433

Open
ERussel wants to merge 14 commits into
mainfrom
feature/sso-integration
Open

SSO message handling bindings for Mobile hosts#433
ERussel wants to merge 14 commits into
mainfrom
feature/sso-integration

Conversation

@ERussel

@ERussel ERussel commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Purpose

The PR introduces methods to process SSO request via Rust core runtime:

  • handleSsoRequest parses raw message, process it and returns an outcome. As there might be a need to perform additional cleanup session on the consumer level outcome includes a separate disconnect marker
  • prepareDisconnectRequest allows to prepare a raw disconnect request when a user want's to close the session

The design assumes that mobile hosts handle SSO session via statement store natively and delegate only requests handling to the rust core. This is an accepted tradeoff now to bring unified TrUAPI handling on both platforms without huge refactoring.

NOTE: PR changes disconnect message id from static truapi:sso:disconnect to random one to prevent collisions between messages. For example, peer might dedup by message id and second time disconnect message might be ignored if they ever received one from that host.

Integration into iOS App: https://github.com/paritytech/polkadot-app-ios-v2/pull/1372

# Conflicts:
#	rust/crates/truapi-server/src/runtime/pairing_host/sso_channel.rs
# Conflicts:
#	android/truapi-host/src/main/kotlin/io/parity/truapi/TrUAPIHost.kt
#	ios/truapi-host/README.md
#	ios/truapi-host/Sources/TrUAPIHost/truapi_server.swift
#	ios/truapi-host/Sources/truapi_serverFFI/include/truapi_serverFFI.h
@ERussel
ERussel requested a review from a team August 18, 2026 04:54
@ERussel
ERussel force-pushed the feature/sso-integration branch from 7bc62c2 to 51e94bd Compare August 18, 2026 04:59
@ERussel
ERussel marked this pull request as draft August 18, 2026 05:14
@ERussel ERussel changed the title SSO message handling bindings for iOS/Android SSO message handling bindings for Mobile hosts Aug 18, 2026
@ERussel
ERussel marked this pull request as ready for review August 18, 2026 08:25
@johnthecat
johnthecat force-pushed the feature/sso-integration branch from 07424c1 to 251acb6 Compare August 18, 2026 14:58
# Conflicts:
#	rust/crates/truapi-server/src/native.rs

@valentinfernandez1 valentinfernandez1 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.

Just 2 small nits. Everything else LGTM

Comment thread README.md
Comment on lines +91 to +97
Both platforms expose `TrUAPIHostRuntime`, the process-owned native runtime; wallet
hosts that manage their own statement-store SSO session can additionally call
`handleSsoRequest` (routes one decrypted remote message through the core,
returning a typed outcome: response bytes to post back, a disconnect marker, or
ignored) and `prepareDisconnectRequest` (builds the SCALE-encoded wire message
for a wallet-initiated disconnect). Response posting and session-record cleanup
remain on the wallet side.

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.

I dont see TrUAPIHostRuntime on Android it only has TrUAPIHostCore, and these two methods weren't added to it, so Android can't call them at all.

&self,
message: Vec<u8>,
) -> Result<SsoRequestOutcome, HostRejection> {
let message = RemoteMessage::decode(&mut message.as_slice()).map_err(|err| {

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.

consider using decode_remote_message(message)

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