#secret #keyring #password #credentials #pim

secret-lib

Rust library to retrieve secrets from different sources

11 unstable releases (3 breaking)

new 0.4.4 Apr 8, 2024
0.4.3 Apr 6, 2024
0.4.1 Mar 14, 2024
0.3.3 Jan 12, 2024
0.1.0 Aug 27, 2023

#119 in Configuration

Download history 62/week @ 2023-12-22 143/week @ 2023-12-29 67/week @ 2024-01-05 64/week @ 2024-01-12 27/week @ 2024-01-19 44/week @ 2024-01-26 34/week @ 2024-02-02 46/week @ 2024-02-09 60/week @ 2024-02-16 116/week @ 2024-02-23 59/week @ 2024-03-01 339/week @ 2024-03-08 215/week @ 2024-03-15 62/week @ 2024-03-22 139/week @ 2024-03-29 561/week @ 2024-04-05

1,125 downloads per month
Used in 8 crates (6 directly)

MIT license

15KB
173 lines

🔐 secret-lib

Rust library to retrieve secrets from different sources: from raw string, from shell commands using process-lib or from global keyring using keyring-lib.

See the full API documentation and some examples.

use secret::{keyring, Secret};

#[tokio::main]
async fn main() {
    // raw secret

    let mut secret = Secret::new_raw("secret");
    assert_eq!(secret.get().await.unwrap(), "secret");

    // shell command secret

    let mut secret = Secret::new_cmd("echo 'secret'");
    assert_eq!(secret.get().await.unwrap(), "secret");

    // keyring secret

    let entry = keyring::KeyringEntry::try_new("key")
        .unwrap()
        .try_with_secret("secret")
        .await
        .unwrap();
    let mut secret = Secret::new_keyring_entry(entry);
    assert_eq!(secret.get().await.unwrap(), "secret");
}

Development

The development environment is managed by Nix. Running nix-shell will spawn a shell with everything you need to get started with the lib: cargo, cargo-watch, rust-bin, rust-analyzer

# Start a Nix shell
$ nix-shell

# then build the lib
$ cargo build -p secret-lib

Contributing

A bug tracker is available on SourceHut. [send an email]

A mailing list is available on SourceHut. [send an email] [subscribe] [unsubscribe]

If you want to report a bug, please send an email at ~soywod/pimalaya@todo.sr.ht.

If you want to propose a feature or fix a bug, please send a patch at ~soywod/pimalaya@lists.sr.ht. The simplest way to send a patch is to use git send-email, follow this guide to configure git properly.

If you just want to discuss about the project, feel free to join the Matrix workspace #pimalaya or contact me directly @soywod. You can also use the mailing list.

Sponsoring

nlnet

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

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

GitHub PayPal Ko-fi Buy Me a Coffee Liberapay

Dependencies

~0.4–15MB
~165K SLoC