pub fn generate_key_pair(
output_dir: impl AsRef<Path>,
passphrase: SecretString,
on_event: impl Fn(&ProgressEvent),
) -> Result<KeyGenOutcome, CryptoError>Expand description
Generates and stores an X25519 key pair for public-key (recipient) encryption.
Writes private.key (passphrase-wrapped at rest) and public.key
(UTF-8 fcr1… recipient string) into output_dir. Returns the
final paths plus the SHA3-256 fingerprint of the public key.
Thin convenience wrapper around KeyPairGenerator. Callers that
need to override Argon2id parameters should use the builder directly:
KeyPairGenerator::with_passphrase(pass).kdf_params(p).write(dir, ev).
§Errors
Returns the same errors as KeyPairGenerator::write.
§Examples
use ferrocrypt::{generate_key_pair, secrecy::SecretString};
let pass = SecretString::from("protect-my-key".to_string());
let outcome = generate_key_pair("./keys", pass, |ev| eprintln!("{ev}"))?;
println!("Fingerprint: {}", outcome.fingerprint);