File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 5353 run : rustup update
5454 - name : Test
5555 run : cargo test
56+ - name : Wipe
57+ run : cargo test test_wipe_device -- --ignored
Original file line number Diff line number Diff line change @@ -345,4 +345,19 @@ impl HWIClient {
345345 status. into ( )
346346 } )
347347 }
348+
349+ /// Wipe a device
350+ pub fn wipe_device ( & self ) -> Result < ( ) , Error > {
351+ Python :: with_gil ( |py| {
352+ let func_args = ( & self . hw_client , ) ;
353+ let output = self
354+ . hwilib
355+ . commands
356+ . getattr ( py, "toggle_passphrase" ) ?
357+ . call1 ( py, func_args) ?;
358+ let output = self . hwilib . json_dumps . call1 ( py, ( output, ) ) ?;
359+ let status: HWIStatus = deserialize_obj ! ( & output. to_string( ) ) ?;
360+ status. into ( )
361+ } )
362+ }
348363}
Original file line number Diff line number Diff line change @@ -212,6 +212,7 @@ mod tests {
212212 )
213213 . unwrap ( ) ;
214214 }
215+
215216 #[ test]
216217 #[ serial]
217218 #[ ignore]
@@ -243,4 +244,20 @@ mod tests {
243244 break ;
244245 }
245246 }
247+
248+ #[ test]
249+ #[ serial]
250+ #[ ignore]
251+ fn test_wipe_device ( ) {
252+ let devices = HWIClient :: enumerate ( ) . unwrap ( ) ;
253+ let unsupported = [ "ledger" , "coldcard" , "jade" ] ;
254+ for device in devices {
255+ if unsupported. contains ( & device. device_type . as_str ( ) ) {
256+ // These devices don't support wipe
257+ continue ;
258+ }
259+ let client = HWIClient :: get_client ( & device, true , types:: HWIChain :: Test ) . unwrap ( ) ;
260+ client. wipe_device ( ) . unwrap ( ) ;
261+ }
262+ }
246263}
You can’t perform that action at this time.
0 commit comments