keyfork wizard generate-shard-secret: create output file if not exists

This commit is contained in:
Ryan Heywood 2024-01-22 18:18:35 -05:00
parent 3b42ba5f00
commit 1112fe0870
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use super::Keyfork;
use clap::{Parser, Subcommand};
use std::{collections::HashSet, fs::OpenOptions, io::IsTerminal, path::PathBuf};
use std::{collections::HashSet, fs::File, io::IsTerminal, path::PathBuf};
use card_backend_pcsc::PcscBackend;
use openpgp_card_sequoia::{state::Open, types::KeyType, Card};
@ -165,7 +165,7 @@ fn generate_shard_secret(
}
if let Some(output_file) = output_file {
let output = OpenOptions::new().write(true).open(output_file)?;
let output = File::create(output_file)?;
keyfork_shard::openpgp::split(threshold, certs, &seed, output)?;
} else {
keyfork_shard::openpgp::split(threshold, certs, &seed, std::io::stdout())?;