Skip to content

Deliver before launch and defer the callback for iOS same-device signing - #49

Open
aaroncox wants to merge 3 commits into
masterfrom
ios-handoff-reliability
Open

Deliver before launch and defer the callback for iOS same-device signing#49
aaroncox wants to merge 3 commits into
masterfrom
ios-handoff-reliability

Conversation

@aaroncox

@aaroncox aaroncox commented Aug 20, 2026

Copy link
Copy Markdown
Member

Makes same-device signing on iOS Safari reliable. Depends on wharfkit/protocol-esr#4.

Three changes to NativeTransport.sign():

  1. The sealed request is awaited to Buoy before the app launch fires. The previous order launched Anchor first and raced the send against Safari suspending the page, so Anchor could wake with nothing to sign. The no-channel fallback also navigated twice; it now launches once.
  2. When the request is same-device and returns to the same page, the callback WebSocket stays closed until the page returns to the foreground. A socket that is open while the page is suspended can consume the delivered signature without JavaScript seeing it, and Buoy will not resend. Deferring keeps the message buffered until a live listener connects.
  3. In that case the callback channel and expected transaction identity are persisted before launch, so a return that iOS opens in a new tab can recover and broadcast the signature with receiveReturnedTransaction. Apps that skip the receive helper are unaffected and the record expires with the request.

For discussion: the anchor://link navigation now fires after an awaited network call, outside the synchronous user-gesture window. Safari permits it and the flow was verified end to end on a physical iPhone, but Safari's gesture policies have changed between releases. If this regresses, an alternative is racing the send against a bounded pre-launch delay.

Desktop, Android, the popup flow, and the non-same-device paths are unchanged. 119 tests pass (114 existing, 5 new). Published as 1.8.0-rc1 under the next tag.

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.

2 participants