keyforkd: extract DerivablePath
This commit is contained in:
parent
a9209ee36a
commit
da96ea94bd
|
@ -253,6 +253,13 @@ version = "1.0.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "keyfork-derive-util"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "keyfork-frame"
|
||||
version = "0.1.0"
|
||||
|
@ -287,6 +294,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bincode",
|
||||
"dirs",
|
||||
"keyfork-derive-util",
|
||||
"keyfork-frame",
|
||||
"keyfork-mnemonic-util",
|
||||
"serde",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
members = [
|
||||
"keyfork-mnemonic-generate",
|
||||
"keyfork-mnemonic-util",
|
||||
"keyfork-derive-util",
|
||||
"keyforkd",
|
||||
"keyfork-frame"
|
||||
]
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "keyfork-derive-util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.186", features = ["derive"] }
|
|
@ -0,0 +1,24 @@
|
|||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct DerivablePath {
|
||||
pub(crate) path: Vec<u32>,
|
||||
}
|
||||
|
||||
// TODO: move DerivablePath into a models crate for clients to produce?
|
||||
/*
|
||||
impl DerivablePath {
|
||||
pub fn new(input: &[&[u8]]) -> DerivablePath {
|
||||
DerivablePath {
|
||||
path: input
|
||||
.iter()
|
||||
.map(|&word| {
|
||||
// perform path validation
|
||||
word.to_vec()
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -13,6 +13,7 @@ multithread = ["tokio/rt-multi-thread"]
|
|||
[dependencies]
|
||||
bincode = "1.3.3"
|
||||
dirs = "5.0.1"
|
||||
keyfork-derive-util = { version = "0.1.0", path = "../keyfork-derive-util" }
|
||||
keyfork-frame = { version = "0.1.0", path = "../keyfork-frame" }
|
||||
keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util" }
|
||||
serde = { version = "1.0.186", features = ["derive"] }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::service::{DerivablePath, DerivationError, Keyforkd};
|
||||
use crate::service::{DerivationError, Keyforkd};
|
||||
use keyfork_frame::asyncext::{try_decode_from, try_encode_to};
|
||||
use keyfork_derive_util::DerivablePath;
|
||||
use std::{io::Error, path::{Path, PathBuf}};
|
||||
use tokio::net::{UnixListener, UnixStream};
|
||||
use tower::{Service, ServiceExt};
|
||||
|
|
|
@ -1,31 +1,9 @@
|
|||
use std::{future::Future, pin::Pin, task::Poll, sync::Arc};
|
||||
|
||||
use keyfork_mnemonic_util::Mnemonic;
|
||||
use keyfork_derive_util::DerivablePath;
|
||||
use tower::Service;
|
||||
use thiserror::Error;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct DerivablePath {
|
||||
pub(crate) path: Vec<Vec<u8>>,
|
||||
}
|
||||
|
||||
// TODO: move DerivablePath into a models crate for clients to produce?
|
||||
/*
|
||||
impl DerivablePath {
|
||||
pub fn new(input: &[&[u8]]) -> DerivablePath {
|
||||
DerivablePath {
|
||||
path: input
|
||||
.iter()
|
||||
.map(|&word| {
|
||||
// perform path validation
|
||||
word.to_vec()
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Keyforkd {
|
||||
|
|
Loading…
Reference in New Issue