crypto_keystore_rs/lib.rs
1//! # crypto-keystore-rs
2//!
3//! A multi-chain keystore library supporting Ethereum and Solana with the Web3 Secret Storage format.
4//!
5//!
6//! ## Example
7//!
8//! ```no_run
9//! # #[cfg(feature = "ethereum")]
10//! # {
11//! use crypto_keystore_rs::{EthereumKeystore, ChainKey};
12//!
13//! let keystore = EthereumKeystore::new("my_password").unwrap();
14//! let uuid = keystore.save_to_file("./keystores").unwrap();
15//!
16//! let loaded = EthereumKeystore::load_from_file(
17//! format!("./keystores/{}.json", uuid),
18//! "my_password"
19//! ).unwrap();
20//!
21//! println!("Ethereum address: {}", loaded.key().unwrap().address());
22//! # }
23//! ```
24
25pub mod chains;
26mod crypto_config;
27pub mod error;
28pub mod kdf_config;
29pub mod keystore;
30
31pub use chains::ChainKey;
32pub use error::{KeystoreError, Result};
33pub use kdf_config::{KdfConfig, KdfParams, KdfType};
34pub use keystore::{Keystore, KeystoreBuilder, KeystoreVersion, VERSION_3, VERSION_4};
35
36// == Keys ==
37
38#[cfg(feature = "ethereum")]
39pub use chains::EthereumKey;
40
41#[cfg(feature = "solana")]
42pub use chains::SolanaKey;
43
44// == Keystores ==
45
46#[cfg(feature = "ethereum")]
47pub type EthereumKeystore = Keystore<EthereumKey>;
48
49#[cfg(feature = "solana")]
50pub type SolanaKeystore = Keystore<SolanaKey>;