File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,21 @@ impl HWIClient {
497497 } )
498498 }
499499
500+ /// Send PIN to a device
501+ pub fn send_pin ( & self , pin : & str ) -> Result < ( ) , Error > {
502+ Python :: with_gil ( |py| {
503+ let func_args = ( & self . hw_client , pin) ;
504+ let output = self
505+ . hwilib
506+ . commands
507+ . getattr ( py, "send_pin" ) ?
508+ . call1 ( py, func_args) ?;
509+ let output = self . hwilib . json_dumps . call1 ( py, ( output, ) ) ?;
510+ let status: HWIStatus = deserialize_obj ! ( & output. to_string( ) ) ?;
511+ status. into ( )
512+ } )
513+ }
514+
500515 /// Get the installed version of hwilib. Returns None if hwi is not installed.
501516 pub fn get_version ( ) -> Option < String > {
502517 Python :: with_gil ( |py| {
Original file line number Diff line number Diff line change @@ -435,6 +435,21 @@ mod tests {
435435 }
436436 }
437437
438+ #[ test]
439+ #[ serial]
440+ #[ ignore]
441+ fn test_send_pin_to_trezor_device ( ) {
442+ let client = HWIClient :: find_device (
443+ None ,
444+ Some ( HWIDeviceType :: Trezor ) ,
445+ None ,
446+ false ,
447+ Network :: Testnet ,
448+ )
449+ . unwrap ( ) ;
450+ client. send_pin ( "123456" ) . unwrap ( ) ;
451+ }
452+
438453 #[ test]
439454 #[ serial]
440455 #[ ignore]
You can’t perform that action at this time.
0 commit comments