From a32ef922c72e86edbdb8adb1584239607aa05c58 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 9 Sep 2023 00:33:22 +0800 Subject: [PATCH] feat: updates --- __security/sensitive/Cargo.lock | 73 +++++++++----------------------- __security/sensitive/Cargo.toml | 4 +- __security/sensitive/src/main.rs | 6 ++- 3 files changed, 29 insertions(+), 54 deletions(-) diff --git a/__security/sensitive/Cargo.lock b/__security/sensitive/Cargo.lock index c9b90d5..0aac43d 100644 --- a/__security/sensitive/Cargo.lock +++ b/__security/sensitive/Cargo.lock @@ -4,70 +4,39 @@ version = 3 [[package]] name = "libc" -version = "0.2.126" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] -name = "sensitive" -version = "0.1.0" +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" dependencies = [ - "sensitive 0.10.0", + "zeroize", ] [[package]] -name = "sensitive" -version = "0.10.0" +name = "secstr" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54024d1c0c0635fb500e74bba938e75a57c697b927e3d05ab5d767fc10868777" +checksum = "e04f657244f605c4cf38f6de5993e8bd050c8a303f86aeabff142d5c7c113e12" dependencies = [ "libc", - "unicode-normalization", - "winapi", ] [[package]] -name = "tinyvec" +name = "sensitive" +version = "0.1.0" +dependencies = [ + "secrecy", + "secstr", + "zeroize", +] + +[[package]] +name = "zeroize" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "unicode-normalization" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/__security/sensitive/Cargo.toml b/__security/sensitive/Cargo.toml index 8a48498..265357f 100644 --- a/__security/sensitive/Cargo.toml +++ b/__security/sensitive/Cargo.toml @@ -6,5 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sensitive = "0.10.0" +secrecy = "0.8.0" +secstr = "0.5.1" +zeroize = "1.6.0" diff --git a/__security/sensitive/src/main.rs b/__security/sensitive/src/main.rs index e7a11a9..86c6b58 100644 --- a/__security/sensitive/src/main.rs +++ b/__security/sensitive/src/main.rs @@ -1,3 +1,7 @@ +use std::str::FromStr; +use secstr::SecStr; + fn main() { - println!("Hello, world!"); + let sec_str = SecStr::from_str("hello world").expect("secstr"); + println!("{:?}", sec_str); }