Expand description
ยง๐ keyring-lib
High-level, asynchronous API for keyring-rs, a cross-platform Rust library to manage credentials.
This library can be seen as a convenient async wrapper around keyring-rs:
- Default keystore based on target OS:
- OpenBSD and FreeBSD: Secret Service
- Linux: Secret Service + keyutils (secure in-memory kernel cache)
- MacOS and iOS: Security framework
- Windows: Security credentials
- tokio async runtime support (requires
tokiofeature) - async-std async runtime support(requires
async-stdfeature) - rustls crypto support (requires
rustlsfeature) - openssl crypto support (requires
opensslfeature, and OpenSSL lib installed (orvendoredfeature)) - serde de/serialization of the keyring entry from/to
String(requiresderivefeature) - Global service name to avoid repetition
- Convenient function to find a secret (
Entry::find_secret -> Result<Option<String>>)
use 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.
ยงSponsoring
Special thanks to the NLnet foundation and the European Commission that helped the project to receive financial support from various programs:
- NGI Assure in 2022
- NGI Zero Entrust in 2023
- NGI Zero Core in 2024 (still ongoing)
If you appreciate the project, feel free to donate using one of the following providers:
Re-exportsยง
pub use native;
Modulesยง
Structsยง
- The representation of a keyring entry.
Enumsยง
- The global
Errorenum of the library.
Functionsยง
- Get the global keyring service name.
- Replace the global keyring service name.
- spawn_
blocking ๐
Type Aliasesยง
- The global
Resultalias of the library.
