keyring-lib 1.0.0

High-level, asynchronous API for keyring-rs, a cross-platform Rust library to manage credentials
keyring-lib-1.0.0 has been yanked.
Visit the last successful build: keyring-lib-1.0.2

🔐 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:
  • tokio async runtime support (requires tokio feature)
  • async-std async runtime support(requires async-std feature)
  • rustls crypto support (requires rustls feature)
  • openssl crypto support (requires openssl feature, and OpenSSL lib installed (or vendored feature))
  • serde de/serialization of the keyring entry from/to String (requires derive feature)
  • 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

nlnet

Special thanks to the NLnet foundation and the European Commission that helped the project to receive financial support from various programs:

If you appreciate the project, feel free to donate using one of the following providers:

GitHub Ko-fi Buy Me a Coffee Liberapay thanks.dev PayPal