Skip to content
Snippets Groups Projects
Commit 97912b2e authored by SamwiseFilmore's avatar SamwiseFilmore
Browse files

Consistency for CLI, crate layout; manifest cleanup

- Use --pkey and --skey in both crates.
- Remove single bin target for pkgar; use main.rs
- Clean up mentions of rand in pkgar
parent d22222bf
No related branches found
No related tags found
1 merge request!6Keys lib
......@@ -19,11 +19,11 @@ fn cli() -> Result<i32, Error> {
let matches = clap_app!(("pkgar-keys") =>
(author: "Wesley Hershberger <mggmugginsmc@gmail.com>")
(about: "NaCl key management for pkgar")
(@arg keyfile: -k --keyfile [FILE] +global "Alternate secret keyfile (defaults to '~/.pkgar/keys/id_ed25519.toml')")
(@arg skey: -s --skey [FILE] +global "Alternate secret keyfile (defaults to '~/.pkgar/keys/id_ed25519.toml')")
(@setting SubcommandRequired)
(@subcommand gen =>
(about: "Generate a keypair and store on the filesystem")
(@arg pubkeyfile: -p --pubkeyfile [FILE]
(@arg pkey: -p --pkey [FILE]
"Alternate public keyfile (defaults to `~/.pkgar/keys/id_ed25519.pub.toml`)")
(@arg plaintext: -P --plaintext
"Do not prompt for a passphrase and store the secret key as plain text")
......@@ -39,7 +39,7 @@ fn cli() -> Result<i32, Error> {
)
).get_matches();
let skey_path = matches.value_of("keyfile")
let skey_path = matches.value_of("skey")
.map(|file| PathBuf::from(file) )
.unwrap_or(DEFAULT_SECKEY.clone());
......@@ -62,7 +62,7 @@ fn cli() -> Result<i32, Error> {
}
}
let pkey_path = submatches.value_of("pubkeyfile")
let pkey_path = submatches.value_of("pkey")
.map(|file| PathBuf::from(file) )
.unwrap_or(DEFAULT_PUBKEY.clone());
......
......@@ -7,10 +7,6 @@ authors = ["Jeremy Soller <jackpot51@gmail.com>", "Wesley Hershberger <mggmuggin
repository = "https://gitlab.redox-os.org/redox-os/pkgar"
edition = "2018"
[[bin]]
name = "pkgar"
required-features = ["clap", "rand", "std"]
[dependencies]
plain = "0.2.3"
pkgar-keys = { path = "../pkgar-keys" }
......@@ -20,20 +16,12 @@ sodiumoxide = { version = "0.2.5", default_features = false }
version = "2.33.0"
optional = true
[dependencies.rand]
version = "0.7.2"
optional = true
[dependencies.rand_core]
version = "0.5.1"
default-features = false
[dependencies.blake3]
version = "0.2.1"
default-features = false
features = ["rayon"]
[features]
default = ["clap", "rand", "std"]
default = ["clap", "std"]
std = []
......@@ -11,8 +11,6 @@ pub enum Error {
Plain(plain::Error),
Overflow,
TryFromInt(core::num::TryFromIntError),
//#[cfg(feature = "rand")]
//Rand(rand_core::Error),
}
#[cfg(feature = "std")]
......
......@@ -17,19 +17,19 @@ fn main() {
let help_pkey = format!("Public key file (defaults to '{}')", &default_pkey);
let help_skey = format!("Secret key file (defaults to '{}')", &default_skey);
let arg_pkey = Arg::with_name("public")
let arg_pkey = Arg::with_name("pkey")
.help(&help_pkey)
.short("p")
.long("public")
.long("pkey")
.required(true)
.takes_value(true)
.value_name("FILE")
.default_value(&default_pkey);
let arg_skey = Arg::with_name("secret")
let arg_skey = Arg::with_name("skey")
.help(&help_skey)
.short("s")
.long("secret")
.long("skey")
.required(true)
.takes_value(true)
.value_name("FILE")
......@@ -79,19 +79,19 @@ fn main() {
let res = if let Some(matches) = matches.subcommand_matches("create") {
create(
matches.value_of("secret").unwrap(),
matches.value_of("skey").unwrap(),
matches.value_of("archive").unwrap(),
matches.value_of("basedir").unwrap()
)
} else if let Some(matches) = matches.subcommand_matches("extract") {
extract(
matches.value_of("public").unwrap(),
matches.value_of("pkey").unwrap(),
matches.value_of("archive").unwrap(),
matches.value_of("basedir").unwrap()
)
} else if let Some(matches) = matches.subcommand_matches("list") {
list(
matches.value_of("public").unwrap(),
matches.value_of("pkey").unwrap(),
matches.value_of("archive").unwrap()
)
} else {
......
......@@ -17,19 +17,19 @@ else
fi
time target/$build/pkgar-keys gen \
--keyfile target/test/secret.toml \
--pubkeyfile target/test/public.toml \
--skey target/test/secret.toml \
--pkey target/test/public.toml \
--plaintext
time target/$build/pkgar \
create \
--secret target/test/secret.toml \
--skey target/test/secret.toml \
--archive target/test/src.pkg \
pkgar/src
time target/$build/pkgar \
extract \
--public target/test/public.toml \
--pkey target/test/public.toml \
--archive target/test/src.pkg \
target/test/src
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment