keyfork: add `recover` porcelain to start keyforkd
This commit is contained in:
parent
e3e7f0bf44
commit
ac2cb3d8ca
|
@ -1065,9 +1065,11 @@ dependencies = [
|
||||||
"keyfork-mnemonic-util",
|
"keyfork-mnemonic-util",
|
||||||
"keyfork-plumbing",
|
"keyfork-plumbing",
|
||||||
"keyfork-shard",
|
"keyfork-shard",
|
||||||
|
"keyforkd",
|
||||||
"serde",
|
"serde",
|
||||||
"smex",
|
"smex",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1273,9 +1275,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.147"
|
version = "0.2.151"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
|
@ -1365,9 +1367,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.8.8"
|
version = "0.8.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
|
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
|
@ -2190,9 +2192,9 @@ version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.5.3"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
|
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
|
@ -2371,9 +2373,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.32.0"
|
version = "1.35.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
|
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2390,9 +2392,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "2.1.0"
|
version = "2.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
io::{stdin, stdout},
|
io::stdin,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::ExitCode,
|
process::ExitCode,
|
||||||
};
|
};
|
||||||
|
@ -40,13 +40,17 @@ fn run() -> Result<()> {
|
||||||
.pop_front()
|
.pop_front()
|
||||||
.expect("any pgp encrypted message");
|
.expect("any pgp encrypted message");
|
||||||
|
|
||||||
|
let mut bytes = vec![];
|
||||||
|
|
||||||
combine(
|
combine(
|
||||||
cert_list,
|
cert_list,
|
||||||
&encrypted_metadata,
|
&encrypted_metadata,
|
||||||
encrypted_messages.into(),
|
encrypted_messages.into(),
|
||||||
stdout(),
|
&mut bytes,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
print!("{}", smex::encode(&bytes));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -559,7 +559,7 @@ pub fn combine(
|
||||||
}
|
}
|
||||||
|
|
||||||
output
|
output
|
||||||
.write_all(smex::encode(&secret).as_bytes())
|
.write_all(&secret)
|
||||||
.map_err(Error::Io)?;
|
.map_err(Error::Io)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -14,3 +14,5 @@ smex = { version = "0.1.0", path = "../smex" }
|
||||||
keyfork-plumbing = { version = "0.1.0", path = "../keyfork-plumbing" }
|
keyfork-plumbing = { version = "0.1.0", path = "../keyfork-plumbing" }
|
||||||
keyfork-shard = { version = "0.1.0", path = "../keyfork-shard" }
|
keyfork-shard = { version = "0.1.0", path = "../keyfork-shard" }
|
||||||
serde = { version = "1.0.192", features = ["derive"] }
|
serde = { version = "1.0.192", features = ["derive"] }
|
||||||
|
keyforkd = { version = "0.1.0", path = "../keyforkd" }
|
||||||
|
tokio = { version = "1.35.1", default-features = false, features = ["rt-multi-thread"] }
|
||||||
|
|
|
@ -3,6 +3,7 @@ use clap::{Parser, Subcommand};
|
||||||
mod mnemonic;
|
mod mnemonic;
|
||||||
mod provision;
|
mod provision;
|
||||||
mod shard;
|
mod shard;
|
||||||
|
mod recover;
|
||||||
|
|
||||||
/// The Kitchen Sink of Entropy.
|
/// The Kitchen Sink of Entropy.
|
||||||
#[derive(Parser, Clone, Debug)]
|
#[derive(Parser, Clone, Debug)]
|
||||||
|
@ -25,8 +26,8 @@ pub enum KeyforkCommands {
|
||||||
#[command(subcommand_negates_reqs(true))]
|
#[command(subcommand_negates_reqs(true))]
|
||||||
Provision(provision::Provision),
|
Provision(provision::Provision),
|
||||||
|
|
||||||
/// Keyforkd background daemon to manage derivation.
|
/// Recover a seed using a recovery mechanism and begin the Keyfork daemon.
|
||||||
Daemon,
|
Recover(recover::Recover),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyforkCommands {
|
impl KeyforkCommands {
|
||||||
|
@ -43,8 +44,8 @@ impl KeyforkCommands {
|
||||||
KeyforkCommands::Provision(p) => {
|
KeyforkCommands::Provision(p) => {
|
||||||
p.handle(keyfork)?;
|
p.handle(keyfork)?;
|
||||||
}
|
}
|
||||||
KeyforkCommands::Daemon => {
|
KeyforkCommands::Recover(r) => {
|
||||||
todo!()
|
r.handle(keyfork)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -86,13 +86,17 @@ impl ShardExec for OpenPGP {
|
||||||
.pop_front()
|
.pop_front()
|
||||||
.expect("any pgp encrypted message");
|
.expect("any pgp encrypted message");
|
||||||
|
|
||||||
|
let mut bytes = vec![];
|
||||||
|
|
||||||
keyfork_shard::openpgp::combine(
|
keyfork_shard::openpgp::combine(
|
||||||
certs,
|
certs,
|
||||||
&encrypted_metadata,
|
&encrypted_metadata,
|
||||||
encrypted_messages.into(),
|
encrypted_messages.into(),
|
||||||
output,
|
&mut bytes,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
write!(output, "{}", smex::encode(&bytes))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue