Skip to content

tmuntaner/keyring-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keyring-rs

A library to interact with your keyring on Linux, Mac, or Windows.

Crates.io Crates.io

Keyring Backends:

Example

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(())
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages