File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,21 @@ impl HWIClient {
497
497
} )
498
498
}
499
499
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
+
500
515
/// Get the installed version of hwilib. Returns None if hwi is not installed.
501
516
pub fn get_version ( ) -> Option < String > {
502
517
Python :: with_gil ( |py| {
Original file line number Diff line number Diff line change @@ -435,6 +435,21 @@ mod tests {
435
435
}
436
436
}
437
437
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
+
438
453
#[ test]
439
454
#[ serial]
440
455
#[ ignore]
You can’t perform that action at this time.
0 commit comments