diff --git a/.vscode/settings.json b/.vscode/settings.json index 26184f7..1532414 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,9 +4,13 @@ "Aspe", "Aspm", "josekit", + "keygrip", + "keywrap", "PKCS", "Pkey", "printdoc", + "subkey", + "subkeys", "writedoc" ] } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e02d9c2..59b5a3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -195,6 +195,7 @@ dependencies = [ "asp", "async-trait", "clap 4.3.9", + "clap-stdin", "data-encoding", "dialoguer", "indoc", @@ -480,6 +481,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "clap-stdin" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3617daa8b997570ed9adb631a57ab10d7a1969fad433950d56e8c24e66ab3aaa" +dependencies = [ + "thiserror", +] + [[package]] name = "clap_builder" version = "4.3.9" diff --git a/Cargo.toml b/Cargo.toml index 67b1d17..0ac541c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,9 +23,10 @@ dialoguer = { version = "0.10.4", features = ["password"] } argon2 = { version = "0.5.0", features = ["std"] } data-encoding = "2.4.0" sea-orm = { version = "0.11.3", features = ["sqlx-sqlite", "runtime-tokio-native-tls"] } -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] } sea-orm-migration = "0.11.3" async-trait = "0.1.68" +tokio = "1.29.1" +clap-stdin = "0.2.0" [profile.release] strip = true diff --git a/src/commands/keys/export.rs b/src/commands/keys/export.rs index 742b7fc..b158c1f 100644 --- a/src/commands/keys/export.rs +++ b/src/commands/keys/export.rs @@ -97,18 +97,15 @@ impl AspmSubcommand for KeysExportCommand { eprintln!( "{style}Exported key \"{alias}\" with fingerprint {fingerprint}:{reset}", style = Anstyle::new() - .bold() - .underline() - .fg_color(Some(AnstyleColor::Ansi(AnsiColor::BrightMagenta))) - .render(), + .bold() + .underline() + .fg_color(Some(AnstyleColor::Ansi(AnsiColor::BrightMagenta))) + .render(), alias = key.alias, fingerprint = decrypted.fingerprint, reset = Reset.render() ); - let _ = writedoc!( - std::io::stdout(), - "{export}" - ); + let _ = writedoc!(std::io::stdout(), "{export}"); } else { eprintln!("There was an error decrypting the key, please make sure the password you entered was correct"); } diff --git a/src/commands/keys/generate.rs b/src/commands/keys/generate.rs index ca6887f..97f3d9b 100644 --- a/src/commands/keys/generate.rs +++ b/src/commands/keys/generate.rs @@ -23,7 +23,7 @@ pub struct KeysGenerateCommand { /// It doesn't really matter that much which one is used, as they both work fine, but Ed25519 is used as a safe default. #[clap(value_enum, default_value_t = KeyGenerationType::Ed25519, long_about, ignore_case = true)] key_type: KeyGenerationType, - /// Tha alias of the key to generate. This can be anything, and it can also be omitted to prompt interactively. This has no purpose other than providing a way to nicely name keys, rather than having to remember a fingerprint. + /// The alias of the key to generate. This can be anything, and it can also be omitted to prompt interactively. This has no purpose other than providing a way to nicely name keys, rather than having to remember a fingerprint. #[arg(short = 'n', long)] key_alias: Option, } diff --git a/src/commands/keys/list.rs b/src/commands/keys/list.rs index 52c53a5..efc2de4 100644 --- a/src/commands/keys/list.rs +++ b/src/commands/keys/list.rs @@ -2,7 +2,7 @@ use anstyle::{AnsiColor, Reset, Style as Anstyle}; use anyhow::Context; use asp::keys::AspKeyType; use clap::Parser; -use indoc::{writedoc}; +use indoc::writedoc; use sea_orm::EntityTrait; use std::io::Write;