diff --git a/README.md b/README.md index 96fe978..2930da1 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ Project or files: │   └── tantivy ├── __security │   ├── keychain-services +│   ├── keyring-demo │   ├── seckey │   ├── secmem-proc │   ├── secrets @@ -312,6 +313,6 @@ Project or files: ├── vec.rs └── while.rs -284 directories, 38 files +285 directories, 38 files ``` diff --git a/__security/keyring-demo/Cargo.lock b/__security/keyring-demo/Cargo.lock new file mode 100644 index 0000000..7b45964 --- /dev/null +++ b/__security/keyring-demo/Cargo.lock @@ -0,0 +1,108 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "keyring" +version = "3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c" +dependencies = [ + "log", + "security-framework 2.11.1", + "security-framework 3.4.0", + "zeroize", +] + +[[package]] +name = "keyring-demo" +version = "0.1.0" +dependencies = [ + "keyring", +] + +[[package]] +name = "libc" +version = "0.2.175" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b369d18893388b345804dc0007963c99b7d665ae71d275812d828c6f089640" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/__security/keyring-demo/Cargo.toml b/__security/keyring-demo/Cargo.toml new file mode 100644 index 0000000..03e6280 --- /dev/null +++ b/__security/keyring-demo/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "keyring-demo" +version = "0.1.0" +edition = "2024" + +[dependencies] +keyring = { version = "3.6.3", features = ["apple-native"] } diff --git a/__security/keyring-demo/src/main.rs b/__security/keyring-demo/src/main.rs new file mode 100644 index 0000000..5f0343d --- /dev/null +++ b/__security/keyring-demo/src/main.rs @@ -0,0 +1,10 @@ +use keyring::{Entry, Result}; + +fn main() -> Result<()> { + let entry = Entry::new("my-service", "my-name")?; + entry.set_password("topS3cr3tP4$$w0rd")?; + let password = entry.get_password()?; + println!("My password is '{}'", password); + entry.delete_credential()?; + Ok(()) +}