2024-08-11 23:25:25 +00:00
|
|
|
#![allow(missing_docs)]
|
2024-01-16 02:44:48 +00:00
|
|
|
|
2024-01-10 20:13:42 +00:00
|
|
|
use keyfork_prompt::{
|
2025-01-04 04:11:33 +00:00
|
|
|
prompt_validated_wordlist,
|
2024-01-10 20:13:42 +00:00
|
|
|
validators::{mnemonic, Validator},
|
2025-01-04 05:30:41 +00:00
|
|
|
default_handler,
|
2024-01-10 20:13:42 +00:00
|
|
|
};
|
2023-12-21 17:04:35 +00:00
|
|
|
|
2024-08-01 13:50:30 +00:00
|
|
|
use keyfork_mnemonic::English;
|
2024-02-19 10:20:33 +00:00
|
|
|
|
2024-01-07 04:23:41 +00:00
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2025-01-04 05:30:41 +00:00
|
|
|
let mut handler = default_handler().unwrap();
|
2024-01-10 20:13:42 +00:00
|
|
|
let transport_validator = mnemonic::MnemonicSetValidator {
|
2025-01-04 05:30:41 +00:00
|
|
|
word_lengths: [24],
|
2024-01-10 20:13:42 +00:00
|
|
|
};
|
|
|
|
|
2025-01-04 04:11:33 +00:00
|
|
|
let mnemonics = prompt_validated_wordlist::<English, _>(
|
2025-01-04 05:30:41 +00:00
|
|
|
&mut *handler,
|
|
|
|
"Enter a 24-word mnemonic: ",
|
2024-01-10 20:13:42 +00:00
|
|
|
3,
|
2025-01-04 04:11:33 +00:00
|
|
|
&*transport_validator.to_fn(),
|
2024-01-10 20:13:42 +00:00
|
|
|
)?;
|
2024-02-12 05:02:59 +00:00
|
|
|
assert_eq!(mnemonics[0].as_bytes().len(), 32);
|
2024-01-10 20:13:42 +00:00
|
|
|
|
2023-12-21 17:04:35 +00:00
|
|
|
Ok(())
|
|
|
|
}
|