Crates.io | secret-lib |
lib.rs | secret-lib |
version | 1.0.0 |
source | src |
created_at | 2023-08-27 12:35:26.697158 |
updated_at | 2024-10-27 10:21:33.47716 |
description | Cross-platform, asynchronous Rust library to retrieve secrets from different sources |
homepage | https://pimalaya.org/ |
repository | https://github.com/pimalaya/core/tree/master/secret/ |
max_upload_size | |
id | 956062 |
size | 27,891 |
Cross-platform, asynchronous Rust library to retrieve secrets from different sources.
process-lib
process-lib
String
The library comes with 8 cargo features, including 4 default ones:
tokio
: enables the tokio async runtimeasync-std
: enables the async-std async runtimerustls
: enables the rustls cryptoopenssl
: enables the openssl cryptocommand
: enables the command-based secret backendkeyring
: enables the keyring-based secret backendderive
: enables serde supportvendored
: compiles and statically link to a copy of non-Rust vendors like OpenSSLuse secret::{keyring::KeyringEntry, 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_command("echo 'secret'");
assert_eq!(secret.get().await.unwrap(), "secret");
// keyring secret
let entry = 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");
}
See the full API documentation on docs.rs.
Special thanks to the NLnet foundation and the European Commission that helped the project to receive financial support from various programs:
If you appreciate the project, feel free to donate using one of the following providers: