use crate::handler::types::{KeyGenData, LibrageResponse};
use age::secrecy::ExposeSecret;
use age::x25519;
use zeroize::Zeroizing;
pub fn generate_keypair() -> LibrageResponse<KeyGenData> {
let identity = x25519::Identity::generate();
let recipient = identity.to_public();
let secret = identity.to_string().expose_secret().to_owned();
LibrageResponse::ok(KeyGenData {
public_key: recipient.to_string(),
secret_key: Zeroizing::new(secret),
})
}