fix: surface locked Trezor as DeviceBusy via trezor-connect-rs 0.3.4#119
Open
coreyphillips wants to merge 2 commits into
Open
fix: surface locked Trezor as DeviceBusy via trezor-connect-rs 0.3.4#119coreyphillips wants to merge 2 commits into
coreyphillips wants to merge 2 commits into
Conversation
Bump trezor-connect-rs to 0.3.4 and map the new typed ThpError::DeviceLocked to TrezorError::DeviceBusy, so a locked Trezor during the THP handshake is surfaced as the typed back-off signal instead of a generic ConnectionError. Mobile clients can prompt the user to unlock rather than reconnecting in a loop. 0.3.4 also classifies DeviceLocked as non-retryable upstream: it no longer churns the transport (close/reopen loop) on a locked device and instead makes a single try_to_unlock handshake attempt so the device prompts for unlock. Regenerates the iOS/Android/Python bindings via ./build.sh all (compiled artifacts only; the UniFFI interface is unchanged since DeviceBusy already existed).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 986000b65b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Collaborator
Author
|
Release created for testing as v0.3.9 here. |
Member
Member
|
I'll implement and test on both platforms |
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.
Context
bitkit-ios #613 (Android counterpart bitkit-android #1030) reports that connecting to a locked Trezor keeps the device busy: the transport was churning in a
close -> wait 2000ms -> reopen -> retryloop and ultimately failing with a locked-device handshake error, instead of backing off and letting the user unlock.The upstream fix landed in
trezor-connect-rs0.3.4, which:ThpError::DeviceLockedvariant.DeviceLockedas non-retryable: no more close/reopen churn on a locked device.try_to_unlock=truehandshake attempt so the device itself prompts the user to unlock, then surfaces the result to the caller.This PR consumes that release and threads the typed signal through to apps.
Changes
trezor-connect-rsfrom 0.3.3 to 0.3.4 (both target-gated dependency entries) and refreshCargo.lock.ThpError::DeviceLockedto the existing typedTrezorError::DeviceBusyinsrc/modules/trezor/errors.rs, so a locked device surfaces as the back-off signal apps already understand rather than a genericConnectionError.DeviceLocked -> DeviceBusymapping../build.sh all.Notes
TrezorError::DeviceBusyalready existed (Swiftcase DeviceBusy/ KotlinTrezorException.DeviceBusy, discriminant 4), so only the compiled binding artifacts were rebuilt. No hand-written binding changes.Package.swiftonly has its xcframework.zip checksum updated. No package version bump was performed (./build.sh allwithout-r); the release/tag bump can happen separately.TrezorFeatures.unlockedandtrezor_refresh_features()already exist for callers that want to poll lock state.Testing
cargo test --lib trezor::errorspasses against the publishedtrezor-connect-rs0.3.4.cargo fmt --checkclean../build.sh allcompleted successfully for iOS, Android, and Python.Follow-up
The app-side back-off / unlock-prompt UX stays owned by bitkit-ios #613 and bitkit-android #1030, which consume this bitkit-core once released.