credent/
lib.rs

1#![deny(missing_debug_implementations, missing_docs)]
2
3//! Manages `~/.config/<app>/credentials`.
4//!
5//! ![demo](https://raw.githubusercontent.com/azriel91/credent/main/demo.png)
6//!
7//! Add the following to Cargo.toml:
8//!
9//! ```toml
10//! credent = { version = "0.4.1", features = ["backend-smol"] } # or "backend-tokio"
11//! ```
12//!
13//! Example code:
14//!
15//! ```rust,ignore
16//! use credent::{
17//!     cli::CredentialsCliReader,
18//!     fs::{model::AppName, CredentialsFile, CredentialsFileStorer},
19//!     model::Credentials,
20//! };
21//!
22//! /// Application name
23//! const CREDENT: AppName<'_> = AppName("credent");
24//!
25//! fn main() -> Result<(), Box<dyn std::error::Error>> {
26//!     smol::run(async {
27//!         let credentials = CredentialsCliReader::<Credentials>::read_from_tty().await?;
28//!         println!("credentials: {}", credentials);
29//!
30//!         CredentialsFileStorer::<Credentials>::store(CREDENT, &credentials).await?;
31//!
32//!         println!(
33//!             "credentials written to: {}",
34//!             CredentialsFile::<Credentials>::path(CREDENT)?.display()
35//!         );
36//!
37//!         Result::<(), Box<dyn std::error::Error>>::Ok(())
38//!     })
39//! }
40//! ```
41//!
42//! More examples can be seen in the [examples].
43//!
44//! [examples]: https://github.com/azriel91/credent/tree/main/examples
45
46pub use credent_cli as cli;
47pub use credent_fs as fs;
48pub use credent_model as model;