From 2de0c5ce10a80b0632cad762bf2e9fa2a4d1987d Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 17 Jan 2024 21:30:36 -0500 Subject: [PATCH] keyfork-plumbing: move back into keyfork-{mnemonic-util,entropy} --- Cargo.lock | 12 ++------ Cargo.toml | 1 - crates/util/keyfork-entropy/Cargo.toml | 5 ++++ .../src/main.rs} | 0 .../src/bin/keyfork-mnemonic-from-seed.rs | 0 crates/util/keyfork-plumbing/Cargo.toml | 12 -------- docs/src/INSTALL.md | 29 ++++++++++--------- 7 files changed, 23 insertions(+), 36 deletions(-) rename crates/util/{keyfork-plumbing/src/bin/keyfork-entropy.rs => keyfork-entropy/src/main.rs} (100%) rename crates/util/{keyfork-plumbing => keyfork-mnemonic-util}/src/bin/keyfork-mnemonic-from-seed.rs (100%) delete mode 100644 crates/util/keyfork-plumbing/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 57aff74..9450256 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1763,6 +1763,9 @@ dependencies = [ [[package]] name = "keyfork-entropy" version = "0.1.0" +dependencies = [ + "smex", +] [[package]] name = "keyfork-frame" @@ -1786,15 +1789,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "keyfork-plumbing" -version = "0.1.0" -dependencies = [ - "keyfork-entropy", - "keyfork-mnemonic-util", - "smex", -] - [[package]] name = "keyfork-prompt" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 4e6cbfa..3e3e872 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ members = [ "crates/util/keyfork-frame", "crates/util/keyfork-mnemonic-util", "crates/util/keyfork-prompt", - "crates/util/keyfork-plumbing", "crates/util/keyfork-slip10-test-data", "crates/util/smex", ] diff --git a/crates/util/keyfork-entropy/Cargo.toml b/crates/util/keyfork-entropy/Cargo.toml index 36d3750..1d5a444 100644 --- a/crates/util/keyfork-entropy/Cargo.toml +++ b/crates/util/keyfork-entropy/Cargo.toml @@ -6,4 +6,9 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = [] +bin = ["smex"] + [dependencies] +smex = { version = "0.1.0", path = "../smex", optional = true } diff --git a/crates/util/keyfork-plumbing/src/bin/keyfork-entropy.rs b/crates/util/keyfork-entropy/src/main.rs similarity index 100% rename from crates/util/keyfork-plumbing/src/bin/keyfork-entropy.rs rename to crates/util/keyfork-entropy/src/main.rs diff --git a/crates/util/keyfork-plumbing/src/bin/keyfork-mnemonic-from-seed.rs b/crates/util/keyfork-mnemonic-util/src/bin/keyfork-mnemonic-from-seed.rs similarity index 100% rename from crates/util/keyfork-plumbing/src/bin/keyfork-mnemonic-from-seed.rs rename to crates/util/keyfork-mnemonic-util/src/bin/keyfork-mnemonic-from-seed.rs diff --git a/crates/util/keyfork-plumbing/Cargo.toml b/crates/util/keyfork-plumbing/Cargo.toml deleted file mode 100644 index 77f5f42..0000000 --- a/crates/util/keyfork-plumbing/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "keyfork-plumbing" -version = "0.1.0" -edition = "2021" -license = "AGPL-3.0-only" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -keyfork-entropy = { version = "0.1.0", path = "../keyfork-entropy" } -keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util" } -smex = { version = "0.1.0", path = "../smex" } diff --git a/docs/src/INSTALL.md b/docs/src/INSTALL.md index 19fc61d..a3e4932 100644 --- a/docs/src/INSTALL.md +++ b/docs/src/INSTALL.md @@ -10,15 +10,16 @@ cargo install --index https://git.distrust.co/public/_cargo-index keyfork@0.1.0 The index is managed by Distrust, but is not signed by developers when commits are created, so a safer alternative may be to build from source. It is -recommended to perform these operations on a machine dedicated for the purpose -of building Rust binaries, to avoid the risk of building a compromised binary. +recommended to perform these operations in an environment dedicated for the +purpose of building Rust binaries, to avoid the risk of building a compromised +binary. ```sh git clone https://git.distrust.co/public/keyfork cd keyfork # git checkout keyfork-0.1.0 git verify-commit HEAD -cargo install --locked --path keyfork +cargo install --locked --path crates/keyfork ``` This will build Keyfork from source, using a local `Cargo.lock` file to ensure @@ -30,15 +31,12 @@ Keyfork offers "plumbing" binaries (as opposed to the "porcelain" `keyfork`) that offer a smaller [SBOM], allowing users with a smaller feature requirement to lessen the requirements for code review. Plumbing binaries can be installed the same way Keyfork is installed, either through the registry or by building -locally. Plumbing binaries are grouped by crates of shared dependencies. For -instance, `keyfork-plumbing` includes all binaries using only shared -dependencies. Eventually, `keyfork-plumbing-openpgp` may contain all -dependencies relevant to OpenPGP (such as the `keyfork-shard` variants, -`keyfork-derive-openpgp`, and `keyfork-provision-openpgp-card`). There may also -be plumbing binaries that exist by themselves, without a plumbing package. -Unfortunately, Cargo offers no convenient way to install a binary from any -package on a workspace, so the information about which package contains which -binary must be known beforehand. +locally. Plumbing binaries may be grouped by crates of shared dependencies if +all dependencies are shared between the binaries. Plumbing binaries may also +exist in crates that exist only to serve as a command-line interface to that +crate, but may require additional dependencies to build a binary. These will be +specified by `--features bin` as a flag that should be passed to `cargo +install`. ```sh -cargo install --index https://git.distrust.co/public/_cargo-index keyfork-plumbing@0.1.0 -cargo install --locked --path keyfork-plumbing --bin keyfork-entropy +# Currently (2024-01-17) unreleased, may not exist yet +cargo install --index https://git.distrust.co/public/_cargo-index keyfork-entropy@0.1.0 --features bin + +# Confirmed to work as of 2024-01-17. +cargo install --locked --path crates/util/keyfork-entropy --bin keyfork-entropy --features bin ``` [SBOM]: https://en.wikipedia.org/wiki/SBOM