Skip to content

Commit

Permalink
add scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 20, 2024
1 parent e3e239a commit 9e0aaf0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ secret-service-zbus-tokio = ["dep:tokio", "secret-service-zbus"]
# Linux Secret service,
# Crypto provider (for encrypted sessions)
#
secret-service-crypto = ["dep:num", "dep:once_cell", "dep:rand"]
secret-service-crypto = ["dep:num", "dep:once_cell", "dep:rand", "secret-service"]
secret-service-openssl-std = ["dep:openssl", "secret-service-crypto"]
secret-service-rust-crypto-std = ["dep:aes", "dep:block-padding", "dep:cbc", "dep:hkdf", "dep:sha2", "secret-service-crypto"]

Expand Down
57 changes: 3 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,10 @@
# 🔐 keyring-lib

High-level, asynchronous API for [`keyring-rs`](https://crates.io/crates/keyring), a cross-platform Rust library to manage credentials.
Cross-platform, sans I/O library to manage credentials, written in Rust.

## Features
![scheme](./scheme.svg)

- Uses [Secret Service](https://specifications.freedesktop.org/secret-service-spec/latest/) on *Linux*
- Uses the [keyutils](https://man7.org/linux/man-pages/man7/keyutils.7.html) secure, in-memory *Linux* kernel cache (if available)
- Uses default system security credential on *MacOS* and *Windows*
- Supports **tokio** and **async-std** async runtimes
- Supports **rustls** and **openssl** crypto libs
- Supports **serde** (de)serialization from/to `String`

The library comes with 6 [cargo features](https://doc.rust-lang.org/cargo/reference/features.html), including 2 default ones:

- **`tokio`**: enables the [tokio](https://crates.io/crates/tokio) async runtime
- `async-std`: enables the [async-std](https://crates.io/crates/async-std) async runtime
- **`rustls`**: enables the [rustls](https://crates.io/crates/rustls) crypto
- `openssl`: enables the [openssl](https://crates.io/crates/openssl) crypto
- `derive`: enables [serde](https://crates.io/crates/serde) support
- `vendored`: compiles and statically link to a copy of non-Rust vendors like OpenSSL

## Example

```rust
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](https://docs.rs/keyring-lib/latest/keyring/).*

## FAQ

<details>
<summary>Why not using <code>keyring-rs</code> directly?</summary>

This library can be seen as a *convenient async wrapper* around `keyring-rs`. If you have an async app and just want to have a default keystore for any target OS, then `keyring-lib` is the right choice. If you do not have an async app, or you want more control over keystores, using `keyring-rs` is a much better choice.
</details>
*TODO*

## Sponsoring

Expand Down
Binary file added scheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions scheme.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9e0aaf0

Please sign in to comment.