feat: add secrets
This commit is contained in:
39
__security/secrets/Cargo.lock
generated
Normal file
39
__security/secrets/Cargo.lock
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.134"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||
|
||||
[[package]]
|
||||
name = "secrets"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"secrets 1.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "secrets"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f51745a213c4a2acabad80cd511e40376996bc83db6ceb4ebc7853d41c597988"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
11
__security/secrets/Cargo.toml
Normal file
11
__security/secrets/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "secrets"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
secrets = "1.2"
|
||||
|
||||
|
||||
12
__security/secrets/src/main.rs
Normal file
12
__security/secrets/src/main.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use secrets::Secret;
|
||||
|
||||
fn main() {
|
||||
Secret::<[u8; 16]>::random(|s| {
|
||||
// use `s` as if it were a `&mut [u8; 16]`
|
||||
//
|
||||
// the memory is `mlock(2)`ed and will be zeroed when this closure
|
||||
// exits
|
||||
println!("{:?}", s);
|
||||
println!("{:?}", *s);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user