#secret

vaultier

Crate to write and read secrets from Hashicorp Vault

5 releases (3 breaking)

0.4.0 Sep 17, 2024
0.3.0 Mar 21, 2024
0.2.1 Oct 20, 2023
0.2.0 Sep 19, 2023
0.1.1 Sep 6, 2023

#76 in #secret

Download history 26/week @ 2024-07-29 4/week @ 2024-08-05 9/week @ 2024-08-26 183/week @ 2024-09-16 36/week @ 2024-09-23 55/week @ 2024-09-30 35/week @ 2024-10-07 44/week @ 2024-10-14 19/week @ 2024-10-21 47/week @ 2024-10-28 20/week @ 2024-11-04 58/week @ 2024-11-11

145 downloads per month

MIT license

19KB
348 lines

Vaultier /slɒθ/ 🦥

Small crate to read secrets from Hashicorp Vault. Based on vaultrs.

Usage

use vaultier::SecretClient;
use serde::Deserialize;

#[derive(Deserialize)]
struct MySecrets {
    pub username: String,
    pub password: String,
}

let address = "<vault instance address>";
let mount = String::from("<mount>");
let base_path = String::from("<base_path>");

// With token or default feature enabled
let client = SecretClient::new(address, mount, base_path, None).unwrap();

// With auth feature enabled
let auth_mount = "<mount to vault auth>";
let role = "<your role>";
let client = SecretClient::create(address, auth_mount, role, mount, base_path).unwrap();

// read secrets from that base path
let secrets = client.read_secrets::<MySecrets>().await.unwrap();

// read secrets from the passed path relative to the base path: mount/data/base_path/my-secrets
let secrets = client.read_secrets_from::<MySecrets>("my-secrets").await.unwrap();

License

MIT

Dependencies

~8–20MB
~273K SLoC