Skip to content

Commit

Permalink
Fix bug where private key is required to add device
Browse files Browse the repository at this point in the history
Fix #56
  • Loading branch information
NilsIrl committed May 2, 2023
1 parent 7716b93 commit fe1568a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ fn main() {
privkey,
name,
} => {
let pubkey = pubkey.unwrap_or(match private_to_public_key(&privkey.unwrap()) {
Ok(pubkey) => pubkey,
Err(_) => {
println!("Invalid private key.");
std::process::exit(2)
}
});
let pubkey =
pubkey.unwrap_or_else(|| match private_to_public_key(&privkey.unwrap()) {
Ok(pubkey) => pubkey,
Err(_) => {
println!("Invalid private key.");
std::process::exit(2)
}
});
println!(
"{}",
&NewDevice {
Expand Down

0 comments on commit fe1568a

Please sign in to comment.