aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/args.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-16 01:03:30 +0000
committerDaniel Mueller <deso@posteo.net>2019-01-26 23:35:09 -0800
commitf038b53dfaf68be0d52d1d8aa3d2df922aabd787 (patch)
tree2e725b3bff52b843a776ba1db40e50007e5ff44d /nitrocli/src/args.rs
parent274ae17ca0fc86ebfcbaa3a6cb4201e2cfd0f622 (diff)
downloadnitrocli-f038b53dfaf68be0d52d1d8aa3d2df922aabd787.tar.gz
nitrocli-f038b53dfaf68be0d52d1d8aa3d2df922aabd787.tar.bz2
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.
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r--nitrocli/src/args.rs10
1 files changed, 10 insertions, 0 deletions
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<String>) -> Result<()> {
commands::status(ctx)
}
+/// Perform a factory reset.
+fn reset(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> 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),