keyfork wizard generate-shard-secret: do not write to terminal

This commit is contained in:
Ryan Heywood 2024-01-08 18:04:58 -05:00
parent 471ff0e972
commit b6f758c2bd
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
use super::Keyfork;
use clap::{Parser, Subcommand};
use std::collections::HashSet;
use std::{collections::HashSet, io::IsTerminal};
use card_backend_pcsc::PcscBackend;
use openpgp_card_sequoia::{state::Open, types::KeyType, Card};
@ -99,6 +99,11 @@ fn generate_shard_secret(threshold: u8, max: u8, keys_per_shard: u8) -> Result<(
let mut pm = PromptManager::new(std::io::stdin(), std::io::stderr())?;
let mut certs = vec![];
let mut seen_cards: HashSet<String> = HashSet::new();
let stdout = std::io::stdout();
assert!(
!stdout.is_terminal(),
"not printing shard to terminal, redirect output"
);
for index in 0..max {
let cert = derive_key(&seed, index)?;