librage 1.1.0

A safe, simple, and complete Rust wrapper for the rage (age) encryption library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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),
    })
}