keyfork-plumbing: initial commit, yoink from keyfork-entropy and keyfork-mnemonic-from-seed

This commit is contained in:
Ryan Heywood 2023-10-02 22:15:21 -05:00
parent de6d8e4b56
commit 18213e1ee1
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
11 changed files with 19 additions and 51 deletions

29
Cargo.lock generated
View File

@ -865,8 +865,8 @@ name = "keyfork"
version = "0.1.0"
dependencies = [
"clap",
"keyfork-entropy",
"keyfork-mnemonic-util",
"keyfork-plumbing",
"smex",
"thiserror",
]
@ -910,13 +910,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "keyfork-entropy"
version = "0.1.0"
dependencies = [
"smex",
]
[[package]]
name = "keyfork-frame"
version = "0.1.0"
@ -928,14 +921,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "keyfork-mnemonic-from-seed"
version = "0.1.0"
dependencies = [
"keyfork-mnemonic-util",
"smex",
]
[[package]]
name = "keyfork-mnemonic-util"
version = "0.1.0"
@ -946,6 +931,14 @@ dependencies = [
"sha2",
]
[[package]]
name = "keyfork-plumbing"
version = "0.1.0"
dependencies = [
"keyfork-mnemonic-util",
"smex",
]
[[package]]
name = "keyfork-slip10-test-data"
version = "0.1.0"
@ -1666,9 +1659,9 @@ dependencies = [
[[package]]
name = "sha2"
version = "0.10.7"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",

View File

@ -6,10 +6,9 @@ members = [
"keyfork-derive-util",
"keyfork-derive-key",
"keyfork-derive-openpgp",
"keyfork-entropy",
"keyfork-frame",
"keyfork-mnemonic-from-seed",
"keyfork-mnemonic-util",
"keyfork-plumbing",
"keyfork-slip10-test-data",
"keyforkd",
"keyforkd-client",

View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "keyfork-mnemonic-generate"
version = "0.1.0"

View File

@ -1,13 +0,0 @@
[package]
name = "keyfork-mnemonic-from-seed"
version = "0.1.0"
description = "A tool to format BIP-0039 mnemonics from hex data."
license = "GPL-3.0"
repository = "https://git.distrust.co/public/keyfork"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util", registry = "distrust" }
smex = { version = "0.1.0", path = "../smex" }

View File

@ -1,5 +0,0 @@
This program is designed to generate a 12- or 24-word mnemonic using system
entropy on an offline, post-5.4-kernel Linux system. For testing purposes, the
command may be run in an insecure environment using `SHOOT_SELF_IN_FOOT=1`. The
program may be passed a seed size as the first and only argument, and only
supports seed sizes of 128 bits or 256 bits, for 12 and 24 word mnemonics.

View File

@ -1,9 +1,10 @@
[package]
name = "keyfork-entropy"
name = "keyfork-plumbing"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util" }
smex = { version = "0.1.0", path = "../smex" }

View File

@ -13,8 +13,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"Maximum supported bit size is 256, got: {bit_size}"
);
keyfork_entropy::ensure_safe();
let entropy = keyfork_entropy::generate_entropy_of_size(bit_size / 8)?;
keyfork_plumbing::ensure_safe();
let entropy = keyfork_plumbing::generate_entropy_of_size(bit_size / 8)?;
println!("{}", smex::encode(&entropy));
Ok(())

View File

@ -6,8 +6,8 @@ edition = "2021"
# 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" }
clap = { version = "4.4.2", features = ["derive", "env"] }
thiserror = "1.0.48"
smex = { version = "0.1.0", path = "../smex" }
keyfork-plumbing = { version = "0.1.0", path = "../keyfork-plumbing" }

View File

@ -89,8 +89,8 @@ impl MnemonicSeedSource {
};
let seed = match self {
MnemonicSeedSource::System => {
keyfork_entropy::ensure_safe();
keyfork_entropy::generate_entropy_of_size(size / 8)?
keyfork_plumbing::ensure_safe();
keyfork_plumbing::generate_entropy_of_size(size / 8)?
}
MnemonicSeedSource::Playing => todo!(),
MnemonicSeedSource::Tarot => todo!(),