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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keyfork-derive-util"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "keyfork-frame"
|
name = "keyfork-frame"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -287,6 +294,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"dirs",
|
"dirs",
|
||||||
|
"keyfork-derive-util",
|
||||||
"keyfork-frame",
|
"keyfork-frame",
|
||||||
"keyfork-mnemonic-util",
|
"keyfork-mnemonic-util",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
members = [
|
members = [
|
||||||
"keyfork-mnemonic-generate",
|
"keyfork-mnemonic-generate",
|
||||||
"keyfork-mnemonic-util",
|
"keyfork-mnemonic-util",
|
||||||
|
"keyfork-derive-util",
|
||||||
"keyforkd",
|
"keyforkd",
|
||||||
"keyfork-frame"
|
"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]
|
[dependencies]
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
dirs = "5.0.1"
|
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-frame = { version = "0.1.0", path = "../keyfork-frame" }
|
||||||
keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util" }
|
keyfork-mnemonic-util = { version = "0.1.0", path = "../keyfork-mnemonic-util" }
|
||||||
serde = { version = "1.0.186", features = ["derive"] }
|
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_frame::asyncext::{try_decode_from, try_encode_to};
|
||||||
|
use keyfork_derive_util::DerivablePath;
|
||||||
use std::{io::Error, path::{Path, PathBuf}};
|
use std::{io::Error, path::{Path, PathBuf}};
|
||||||
use tokio::net::{UnixListener, UnixStream};
|
use tokio::net::{UnixListener, UnixStream};
|
||||||
use tower::{Service, ServiceExt};
|
use tower::{Service, ServiceExt};
|
||||||
|
|
|
@ -1,31 +1,9 @@
|
||||||
use std::{future::Future, pin::Pin, task::Poll, sync::Arc};
|
use std::{future::Future, pin::Pin, task::Poll, sync::Arc};
|
||||||
|
|
||||||
use keyfork_mnemonic_util::Mnemonic;
|
use keyfork_mnemonic_util::Mnemonic;
|
||||||
|
use keyfork_derive_util::DerivablePath;
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
use thiserror::Error;
|
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)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Keyforkd {
|
pub struct Keyforkd {
|
||||||
|
|
Loading…
Reference in New Issue