Skip to content

Commit b05cf9c

Browse files
committed
Add function for toggle_passphrase
Also adds test for toggle_passphrase
1 parent d30bb76 commit b05cf9c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/interface.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,10 @@ mod tests {
218218
HWIClient::install_udev_rules(None, None).unwrap()
219219
}
220220
}
221+
222+
#[test]
223+
#[serial]
224+
fn test_toggle_passphrase() {
225+
get_first_device().toggle_passphrase().unwrap()
226+
}
221227
}

0 commit comments

Comments
 (0)