Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azriel91/credent
Manages `~/.config/<app>/credentials`.
https://github.com/azriel91/credent
hacktoberfest
Last synced: 3 months ago
JSON representation
Manages `~/.config/<app>/credentials`.
- Host: GitHub
- URL: https://github.com/azriel91/credent
- Owner: azriel91
- License: apache-2.0
- Created: 2020-09-08T08:36:47.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-27T04:41:54.000Z (over 1 year ago)
- Last Synced: 2024-10-08T02:41:17.479Z (3 months ago)
- Topics: hacktoberfest
- Language: Rust
- Homepage:
- Size: 124 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 🔑 Credent
[![Crates.io](https://img.shields.io/crates/v/credent.svg)](https://crates.io/crates/credent)
[![docs.rs](https://img.shields.io/docsrs/credent)](https://docs.rs/credent)
[![CI](https://github.com/azriel91/credent/workflows/CI/badge.svg)](https://github.com/azriel91/credent/actions/workflows/ci.yml)
[![Coverage Status](https://codecov.io/gh/azriel91/credent/branch/main/graph/badge.svg)](https://codecov.io/gh/azriel91/credent)Manages `~/.config//credentials`.
![](demo.png)
## Usage
Add the following to Cargo.toml:
```toml
credent = { version = "0.4.1", features = ["backend-smol"] } # or "backend-tokio"
```Example code:
```rust
use credent::{
cli::CredentialsCliReader,
fs::{model::AppName, CredentialsFile, CredentialsFileStorer},
model::Credentials,
};/// Application name
const CREDENT: AppName<'_> = AppName("credent");fn main() -> Result<(), Box> {
smol::run(async {
let credentials = CredentialsCliReader::::read_from_tty().await?;
println!("credentials: {}", credentials);CredentialsFileStorer::::store(CREDENT, &credentials).await?;
println!(
"credentials written to: {}",
CredentialsFile::::path(CREDENT)?.display()
);Result::<(), Box>::Ok(())
})
}
```More examples can be seen in the [examples](examples).
```bash
# Use either "backend-smol" or "backend-tokio"
cargo run --features "backend-smol" --example simple
cargo run --features "backend-smol" --example demo
cargo run --features "backend-smol" --example profiles
cargo run --features "backend-smol" --example profiles -- --profile development
```## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.