age_setup/lib.rs
1//! # age-setup
2//!
3//! A library for generating age keypairs (X25519) with validation and secure memory handling.
4//!
5//! This crate provides a simple way to create a keypair for age encryption,
6//! returning a [`KeyPair`] containing a public key (starting with "age1") and a secret key.
7//! The secret key is automatically zeroized on drop for security.
8//!
9//! # Example
10//!
11//! ```
12//! use age_setup::build_keypair;
13//!
14//! let keypair = build_keypair().expect("failed to generate keypair");
15//! println!("Public key: {}", keypair.public);
16//! println!("Secret key: [REDACTED]"); // Display redacts secret
17//! // Access raw secret with .expose() – use with caution!
18//! # let _ = keypair.secret.expose();
19//! ```
20//!
21//! # Features
22//! - Generate X25519 keypairs compatible with age.
23//! - Public key validation (must start with "age1").
24//! - Secret key zeroization on drop.
25//! - Redacted `Display` for secret key.
26//! - Error handling with detailed error types.
27
28pub mod apis;
29pub mod build;
30pub mod errors;
31pub mod security;
32pub mod types;
33
34pub use apis::build::build_keypair;
35pub use errors::{Error, Result};
36pub use types::KeyPair;