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 @@ -293,4 +293,19 @@ impl HWIClient {
293293 status. into ( )
294294 } )
295295 }
296+
297+ /// Toggle whether the device is using a BIP 39 passphrase.
298+ pub fn toggle_passphrase ( & self ) -> Result < ( ) , Error > {
299+ Python :: with_gil ( |py| {
300+ let func_args = ( & self . hw_client , ) ;
301+ let output = self
302+ . hwilib
303+ . commands
304+ . getattr ( py, "toggle_passphrase" ) ?
305+ . call1 ( py, func_args) ?;
306+ let output = self . hwilib . json_dumps . call1 ( py, ( output, ) ) ?;
307+ let status: HWIStatus = deserialize_obj ! ( & output. to_string( ) ) ?;
308+ status. into ( )
309+ } )
310+ }
296311}
Original file line number Diff line number Diff line change @@ -218,4 +218,19 @@ mod tests {
218218 HWIClient :: install_udev_rules ( None , None ) . unwrap ( )
219219 }
220220 }
221+
222+ #[ test]
223+ #[ serial]
224+ fn test_toggle_passphrase ( ) {
225+ let devices = HWIClient :: enumerate ( ) . unwrap ( ) ;
226+ for device in devices {
227+ if device. device_type == "ledger" {
228+ // Ledger devices don't support togglepassphrase
229+ continue ;
230+ }
231+ let client = HWIClient :: get_client ( & device, true , types:: HWIChain :: Test ) . unwrap ( ) ;
232+ client. toggle_passphrase ( ) . unwrap ( ) ;
233+ break ;
234+ }
235+ }
221236}
You can’t perform that action at this time.
0 commit comments