aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 6442005..4fd2b0c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -32,6 +32,9 @@ pub struct Args {
help = "Generate 'count' identities"
)]
gen_id_count: Option<u8>,
+ /// Increases the security level of all identities in the config file
+ #[structopt(short, long = "increase-security-level")]
+ wanted_level: Option<u8>,
#[structopt(
short = "a",
long = "address",
@@ -103,6 +106,27 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
return Ok(());
}
+ if let Some(level) = args.wanted_level {
+ if let Some(id) = &mut config.id {
+ info!("Upgrading master identity");
+ id.upgrade_level(level).expect("can upgrade level");
+ }
+
+ if let Some(ids) = &mut config.ids {
+ let len = ids.len();
+ for (i, id) in ids.iter_mut().enumerate() {
+ info!("Upgrading bot identity {}/{}", i + 1, len);
+ id.upgrade_level(level).expect("can upgrade level");
+ }
+ }
+
+ let toml = toml::to_string(&config)?;
+ let mut file = File::create(&args.config_path)?;
+ file.write_all(toml.as_bytes())?;
+
+ return Ok(());
+ }
+
if config.id.is_none() || config.ids.is_none() {
error!("Failed to find required identites, try running with `-g`");
return Ok(());