From f038b53dfaf68be0d52d1d8aa3d2df922aabd787 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 16 Jan 2019 01:03:30 +0000 Subject: Add the reset command to perform a factory reset After performing the factory reset, we also build the AES key so that the device is fully usable. Due to timing issue, we have to add a delay between the factory reset and building the AES key. --- nitrocli/src/args.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nitrocli/src/args.rs') diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index 3b89bf1..43f866d 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -81,6 +81,7 @@ Enum! {Command, [ Otp => ("otp", otp), Pin => ("pin", pin), Pws => ("pws", pws), + Reset => ("reset", reset), Status => ("status", status), Storage => ("storage", storage) ]} @@ -192,6 +193,15 @@ fn status(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { commands::status(ctx) } +/// Perform a factory reset. +fn reset(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { + let mut parser = argparse::ArgumentParser::new(); + parser.set_description("Performs a factory reset"); + parse(ctx, &parser, args)?; + + commands::reset(ctx) +} + Enum! {StorageCommand, [ Close => ("close", storage_close), Hidden => ("hidden", storage_hidden), -- cgit v1.2.1