24 lines
592 B
Rust
24 lines
592 B
Rust
use clap::Parser;
|
|
use keyfork_derive_util::{
|
|
request::{DerivationAlgorithm, DerivationRequest, DerivationResponse},
|
|
DerivationPath,
|
|
};
|
|
use keyforkd_client::{Client, Result};
|
|
|
|
#[derive(Parser, Clone, Debug)]
|
|
pub struct Command {
|
|
#[arg(long)]
|
|
pub path: DerivationPath,
|
|
|
|
#[arg(long)]
|
|
pub algorithm: DerivationAlgorithm,
|
|
}
|
|
|
|
impl Command {
|
|
pub fn handle(&self) -> Result<DerivationResponse> {
|
|
let mut client = Client::discover_socket()?;
|
|
let request = DerivationRequest::new(self.algorithm.clone(), &self.path);
|
|
client.request(&request)
|
|
}
|
|
}
|