age_vault/lib.rs
1//! # Age Vault
2//!
3//! A secure vault for managing age-encrypted accounts and data.
4//!
5//! This crate provides a file-based vault that stores accounts (each with an age keypair)
6//! encrypted using a master password. It supports adding/removing accounts, listing them,
7//! and encrypting/decrypting arbitrary data for specific recipients.
8//!
9//! # Example
10//!
11//! ```rust
12//! use age_vault::{Vault, Role};
13//! use std::path::PathBuf;
14//!
15//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
16//! let path = PathBuf::from("./test_vault.ndbx");
17//! let master_pw = "my_secure_master_password";
18//!
19//! // Create a new vault
20//! let mut vault = Vault::create(&path, master_pw)?;
21//!
22//! // Add an account
23//! let account = vault.add_account("alice", Role::Admin)?;
24//!
25//! // Encrypt data for Alice
26//! let plaintext = b"secret message";
27//! let ciphertext = vault.encrypt_for(&["alice"], plaintext)?;
28//!
29//! // Decrypt using Alice's key
30//! let decrypted = vault.decrypt_with("alice", &ciphertext)?;
31//! assert_eq!(decrypted, plaintext);
32//!
33//! // Clean up
34//! std::fs::remove_file(&path)?;
35//! # Ok(())
36//! # }
37//! ```
38
39pub mod account;
40pub mod crypto;
41pub mod error;
42pub mod store;
43pub mod vault;
44
45/// Re-export of [`account::Account`].
46pub use account::Account;
47
48/// Re-export of [`account::Role`].
49pub use account::Role;
50
51/// Re-export of [`error::Error`].
52pub use error::Error;
53
54/// Re-export of [`error::Result`].
55pub use error::Result;
56
57/// Re-export of [`vault::Vault`].
58pub use vault::Vault;