From 1112fe0870af9fe62d3033ab11fde73d1676bb6b Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 22 Jan 2024 18:18:35 -0500 Subject: [PATCH] keyfork wizard generate-shard-secret: create output file if not exists --- crates/keyfork/src/cli/wizard.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/keyfork/src/cli/wizard.rs b/crates/keyfork/src/cli/wizard.rs index a405b2a..2793890 100644 --- a/crates/keyfork/src/cli/wizard.rs +++ b/crates/keyfork/src/cli/wizard.rs @@ -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())?;