Crates.io | keyring-lib |
lib.rs | keyring-lib |
version | 1.0.2 |
source | src |
created_at | 2023-08-27 12:19:01.973715 |
updated_at | 2024-10-27 07:08:00.012407 |
description | High-level, asynchronous API for keyring-rs, a cross-platform Rust library to manage credentials |
homepage | https://pimalaya.org/ |
repository | https://github.com/pimalaya/core/tree/master/keyring/ |
max_upload_size | |
id | 956046 |
size | 24,126 |
High-level, asynchronous API for keyring-rs
, a cross-platform Rust library to manage credentials.
String
The library comes with 6 cargo features, including 2 default ones:
tokio
: enables the tokio async runtimeasync-std
: enables the async-std async runtimerustls
: enables the rustls cryptoopenssl
: enables the openssl cryptoderive
: enables serde supportvendored
: compiles and statically link to a copy of non-Rust vendors like OpenSSLuse keyring::{set_global_service_name, KeyringEntry};
#[tokio::main]
async fn main() {
// define the global keyring service name once
set_global_service_name("example");
// create a keyring entry from a key string
let entry = KeyringEntry::try_new("key").unwrap();
// define a secret
entry.set_secret("secret").await.unwrap();
// get a secret
entry.get_secret().await.unwrap();
// find a secret
entry.find_secret().await.unwrap();
// delete a secret entry
entry.delete_secret().await.unwrap();
}
See the full API documentation on docs.rs.
keyring-rs
directly?This library can be seen as a convenient async wrapper around keyring-rs
. If you have an async app and just want to have a default keystore for any target OS, then keyring-lib
is the right choice. If you do not have an async app, or you want more control over keystores, using keyring-rs
is a much better choice.
Special thanks to the NLnet foundation and the European Commission that helped the project to receive financial support from various programs:
All the credits go to keyring-rs
. The maintainers are doing a great job there, consider supporting them first.
That said, if you appreciate this project, feel free to donate using one of the following providers: