From a07eb31766b8becbe140d0b94fcaec813909737b Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Sun, 29 Dec 2024 12:13:35 +0000 Subject: [PATCH] load keys from paths in env --- Cargo.toml | 2 +- src/main.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a0ecf5..b5be8f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] anyhow = "1.0.95" -clap = { version = "4.5.23", features = ["derive"] } +clap = { version = "4.5.23", features = ["derive", "env"] } git2 = "0.19.0" rpassword = "7.3.1" zeroize = "1.8.1" diff --git a/src/main.rs b/src/main.rs index 3a038a6..44e7085 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,13 +30,13 @@ enum Action { /// Hash a key and return it Fingerprint { /// The path to the base64 encoded key to hash - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_PUB")] key: PathBuf, }, /// Sign an arbitrary object Sign { /// The path to the base64 encoded secret key to sign with - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_SEC")] secret_key: PathBuf, /// The git revision to sign @@ -45,7 +45,7 @@ enum Action { /// Verify the signature over some git revision Verify { /// The path to the base64 encoded public key to verify with - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_PUB")] public_key: PathBuf, /// The signed git revision to verify @@ -64,7 +64,7 @@ enum Action { /// Store a reference to a public key Store { /// The path to the base64 encoded public key to store - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_PUB")] key: PathBuf, }, } @@ -74,7 +74,7 @@ enum RawAction { /// Sign an arbitrary object and return a tree with the signature Sign { /// The path to the base64 encoded secret key to sign with - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_SEC")] secret_key: PathBuf, /// The git revision to sign @@ -83,7 +83,7 @@ enum RawAction { /// Verify the signature contained in a tree object Verify { /// The path to the base64 encoded public key to verify with - #[arg(short = 'k', long)] + #[arg(short = 'k', long, env = "GIT_KEY_PUB")] public_key: PathBuf, /// Print the id of the signed object to stdout -- 2.51.2