keyfork wizard generate-shard-secret: create output file if not exists
This commit is contained in:
parent
3b42ba5f00
commit
1112fe0870
|
@ -1,6 +1,6 @@
|
||||||
use super::Keyfork;
|
use super::Keyfork;
|
||||||
use clap::{Parser, Subcommand};
|
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 card_backend_pcsc::PcscBackend;
|
||||||
use openpgp_card_sequoia::{state::Open, types::KeyType, Card};
|
use openpgp_card_sequoia::{state::Open, types::KeyType, Card};
|
||||||
|
@ -165,7 +165,7 @@ fn generate_shard_secret(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(output_file) = output_file {
|
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)?;
|
keyfork_shard::openpgp::split(threshold, certs, &seed, output)?;
|
||||||
} else {
|
} else {
|
||||||
keyfork_shard::openpgp::split(threshold, certs, &seed, std::io::stdout())?;
|
keyfork_shard::openpgp::split(threshold, certs, &seed, std::io::stdout())?;
|
||||||
|
|
Loading…
Reference in New Issue