feat(trezor): return typed PassphraseResponse#91
Open
coreyphillips wants to merge 1 commit into
Open
Conversation
- Migrates Trezor passphrase handling from a `String` to the typed `PassphraseResponse` enum (`Cancel` / `Standard` / `Hidden { value }`) introduced in trezor-connect-rs 0.3.0
Collaborator
Author
|
Release for testing here. |
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.
Migrates Trezor passphrase handling from a
Stringto the typedPassphraseResponseenum (Cancel/Standard/Hidden { value }) introduced in trezor-connect-rs 0.3.0Description
Bumps
trezor-connect-rs0.2.8 → 0.3.0 and adopts its new typed passphrasecallback, replacing the old stringly-typed API.
Why: the previous
on_passphrase_request(...) -> Stringencoding used""to mean cancel and any non-empty string to mean hidden wallet. Thisleft no way to express the standard wallet case (
Some("")on the device —an empty passphrase that selects the standard wallet rather than a hidden one).
A user selecting the standard wallet would send
"", which was interpreted ascancel. The new
Standardvariant closes that gap.Changes:
on_passphrase_requestnow returnsPassphraseResponse(Cancel/Standard/Hidden { value }) instead ofString.PassphraseResponseto UniFFI bindings via#[uniffi::remote(Enum)]rather than forking the type (trezor-connect-rsintentionally has no uniffi dependency). The variant list is kept in sync
with upstream and guarded by tests.
UiCallbackAdapter::on_passphrase_requestto a pass-through (bothtraits now return the same upstream type). PIN keeps the legacy
String → Optionencoding (no upstream enum exists for it).TrezorError::PassphraseCancelled, mapped from the new upstreamTcDeviceError::PassphraseCancelled.critical Standard-must-not-become-Cancel case and
on_deviceforwarding.Cargo.toml,Package.swift+ checksum,gradle.properties) and regenerates Swift / Kotlin / Python bindings.Preview
N/A — Rust FFI library change, no UI surface.
QA Notes
Automated:
cargo test modules::trezor— all pass, including the newtest_passphrase_adapter_*/test_pin_adapter_*cases.cargo clippy— no new warnings introduced by this change.Manual (on-device, against the updated app binding):
the operation proceeds (previously this was treated as cancel).
PassphraseCancelled.on_devicepathacknowledges and proceeds.