diff --git a/__security/secrets/Cargo.lock b/__security/secrets/Cargo.lock new file mode 100644 index 0000000..242d917 --- /dev/null +++ b/__security/secrets/Cargo.lock @@ -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" diff --git a/__security/secrets/Cargo.toml b/__security/secrets/Cargo.toml new file mode 100644 index 0000000..68e7924 --- /dev/null +++ b/__security/secrets/Cargo.toml @@ -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" + + diff --git a/__security/secrets/src/main.rs b/__security/secrets/src/main.rs new file mode 100644 index 0000000..b09f851 --- /dev/null +++ b/__security/secrets/src/main.rs @@ -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); + }); +}