keyring-search 0.2.2

Cross-platform library for searching the platform specific credential store, made possible by keyring-rs
Documentation

Keyring-search v0.2.0

build dependencies crates.io docs.rs

Usage

To use this library in your project add the following to your Cargo.toml file:

[dependencies]

keyring-search = "0.2.0"

This is a cross-platform library for searching the platform specific keystore.

Currently supported platforms are Linux, Windows, macOS, and iOS.

Design

This crate, originally planned as a feature for keyring provides a broad search of the platform specific keystores based on user provided search parameters.

Windows

Windows machines have the option to search by 'user', 'service', or 'target'.

use keyring_search::{Search, Limit, List};

let result = Search::new()
    .expect("ERROR")
    .by("user", "test-user");
let list = List::list_credentials(result, Limit::All)
    .expect("Error");

println!("{}", list);

Linux - Secret Service

If using the Linux Secret Service platform, the keystore is stored as a HashMap, and thus is more liberal with the keys that can be searched. The by method will take any parameter passed and attempt to search for the user defined key.

use keyring_search::{Search, Limit, List};

let result = Search::new()
    .expect("ERROR")
    .by("user", "test-user");
let list = List::list_credentials(result, Limit::All)
    .expect("Error");

println!("{}", list);

Linux - Keyutils

If using the Linux Keyutils platform, the keystore is non persistent and is used more as a secure cache. However, this can still be searched. The breadth of the by method is large and encompasses the different types of keyrings available: "thread", "process", "session, "user", "user session", and "group". Because of this searching mechanism, the search has to be rather specific while limiting the different types of data to search, i.e. user, account, service.

use keyring_search::{Search, Limit, List};

let result = Search::new()
    .expect("ERROR")
    .by("session", "test-user@test-service");
let list = List::list_credentials(result, Limit::All)
    .expect("Error");

println!("{}", list);

MacOS

MacOS machines have the option to search by 'account', 'service', or 'label.

use keyring_search::{Search, Limit, List};

let result = Search::new()
    .expect("ERROR")
    .by("account", "test-user");
let list = List::list_credentials(result, Limit::All)
    .expect("Error");

println!("{}", list);

Errors

Search Error is the only error type currently.

Examples

Examples coming soon.

Client Testing

Basic tests for the search platform.

Platforms

MacOS, Windows, iOS, Linux-Keyutils/Secret Service

License

Licensed under either

at your option.