Crates.io | tmuntaner-keyring |
lib.rs | tmuntaner-keyring |
version | 0.1.0-alpha.15 |
source | src |
created_at | 2021-10-27 17:35:36.240234 |
updated_at | 2022-11-17 14:37:42.223582 |
description | A keyring client for linux, mac, and windows |
homepage | https://github.com/tmuntaner/keyring-rs |
repository | https://github.com/tmuntaner/keyring-rs |
max_upload_size | |
id | 473164 |
size | 82,828 |
A library to interact with your keyring on Linux, Mac, or Windows.
See example.rs for the full file.
use anyhow::{Result, anyhow};
use tmuntaner_keyring::KeyringClient;
fn main() -> Result<()> {
let username = "tmuntaner";
let service = "keyring-rs-example";
let application = "keyring-rs";
let keyring = KeyringClient::new(username, service, application)?;
let password = String::from("foobar");
println!("Setting password {}", password);
keyring.set_password(password.clone())?;
let result = keyring.get_password()?.ok_or_else(|| anyhow!("should have a password"))?;
println!("Returned password: {}", password);
assert_eq!(password, result);
Ok(())
}