#![allow(missing_docs)] use std::io::{stdin, stdout}; use keyfork_prompt::{ prompt_validated_wordlist, validators::{mnemonic, Validator}, Terminal, }; use keyfork_mnemonic::English; fn main() -> Result<(), Box> { let mut mgr = Terminal::new(stdin(), stdout())?; let transport_validator = mnemonic::MnemonicSetValidator { word_lengths: [9, 24], }; let combine_validator = mnemonic::MnemonicSetValidator { word_lengths: [24, 48], }; let mnemonics = prompt_validated_wordlist::( &mut mgr, "Enter a 9-word and 24-word mnemonic: ", 3, &*transport_validator.to_fn(), )?; assert_eq!(mnemonics[0].as_bytes().len(), 12); assert_eq!(mnemonics[1].as_bytes().len(), 32); let mnemonics = prompt_validated_wordlist::( &mut mgr, "Enter a 24 and 48-word mnemonic: ", 3, &*combine_validator.to_fn(), )?; assert_eq!(mnemonics[0].as_bytes().len(), 32); assert_eq!(mnemonics[1].as_bytes().len(), 64); Ok(()) }