keyfork-seed: add Client::discover_socket()?
This commit is contained in:
parent
fe8b901bd3
commit
ff351b12a9
|
@ -13,6 +13,10 @@ impl Client {
|
|||
Self { socket }
|
||||
}
|
||||
|
||||
pub fn discover_socket() -> Result<Self> {
|
||||
super::socket::get_socket().map(|socket| Self { socket })
|
||||
}
|
||||
|
||||
pub fn request(&mut self, req: &DerivationRequest) -> Result<DerivationResponse> {
|
||||
try_encode_to(&bincode::serialize(&req)?, &mut self.socket)?;
|
||||
let resp = try_decode_from(&mut self.socket)?;
|
||||
|
|
|
@ -7,8 +7,7 @@ use keyfork_seed::*;
|
|||
|
||||
fn main() -> Result<()> {
|
||||
let args = cli::get_args();
|
||||
let socket = socket::get_socket()?;
|
||||
let mut client = client::Client::new(socket);
|
||||
let mut client = Client::discover_socket()?;
|
||||
let path = args.get_one::<DerivationPath>("path").expect("required");
|
||||
let algo = args
|
||||
.get_one::<DerivationAlgorithm>("algorithm")
|
||||
|
|
Loading…
Reference in New Issue