rust-hwi icon indicating copy to clipboard operation
rust-hwi copied to clipboard

Add prompt_pin and send_pin HWI commands

Open ben-kaufman opened this issue 1 year ago • 6 comments

Add support for HWI prompt_pin and send_pin commands (for Trezor One).

Not sure there's a good way to automate testing for that with an emulator though.

Tested on a physical Trezor One.

ben-kaufman avatar Sep 03 '24 16:09 ben-kaufman

Concept ACK. Please add a comment if you were able to manually test this with a physical device.

notmandatory avatar Sep 05 '24 16:09 notmandatory

Thanks @notmandatory, I've added an ignore note.

I have also added the prompt PIN command.

Also something important to note, in the test, I had to use get_client and specify device path due to this bug in HWI itself: https://github.com/bitcoin-core/HWI/issues/636

The problem is that currently, due to how we process errors in enumerate, it will not be possible to get the path of the Trezor One using Rust HWI, which makes this a lot less useful. This is because when the enumerate encounters an error, it won't return the rest of the device data like its path, but instead will only return an HWI Error. This prevents us from learning the path, and being able to use it in get client before the device is unlocked.

So what can be done is to instead of returning an error, return the fields we can, and add an error field to HWIDevice itself. If that solution makes sense let me know and I could implement it. It will require some chnages to the data structures though, which is why I want to know first if this would be a good way to do it.

ben-kaufman avatar Sep 08 '24 13:09 ben-kaufman

@ben-kaufman do you want to get #105 in before we do a new release for this one?

notmandatory avatar Sep 23 '24 23:09 notmandatory

@notmandatory sure, I think I can resolve the conflicts this week. It's mainly just getting the new signer component to use the new structure.

ben-kaufman avatar Sep 24 '24 00:09 ben-kaufman

@notmandatory I believe after merging this, we should also handle the issue that prevents an effective use of it by changing how device errors are handled on enumerate. Is there a good place to discuss the best way to handle these errors, or should I just submit a suggested implementation PR?

ben-kaufman avatar Sep 26 '24 10:09 ben-kaufman

Best to open a new issue or PR to discuss improving the error handling.

notmandatory avatar Dec 09 '24 23:12 notmandatory