diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7b261ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/target +/.idea/ +/.scannerwork/ +/.act/ +gman.iml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f75c491 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2232 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + +[[package]] +name = "anyhow" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + +[[package]] +name = "argon2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" +dependencies = [ + "base64ct", + "blake2", + "cpufeatures", + "password-hash", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "cc" +version = "1.2.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5252b3d2648e5eedbc1a6f501e3c795e07025c1e93bbf8bbdd6eef7f447a6d54" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.0", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clap" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", +] + +[[package]] +name = "clap_complete" +version = "4.5.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d9501bd3f5f09f7bbee01da9a511073ed30a80cd7a509f1214bb74eadea71ad" +dependencies = [ + "clap", +] + +[[package]] +name = "clap_derive" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "confy" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29222b549d4e3ded127989d523da9e928918d0d0d7f7c1690b439d0d538bae9" +dependencies = [ + "directories", + "serde", + "serde_yaml", + "thiserror", +] + +[[package]] +name = "convert_case" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags", + "crossterm_winapi", + "derive_more", + "document-features", + "mio", + "parking_lot", + "rustix", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "destructure_traitobject" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c877555693c14d2f84191cfd3ad8582790fc52b5e2274b40b59cf5f5cea25c7" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.60.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "document-features" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +dependencies = [ + "litrs", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.4+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "gman" +version = "0.1.0" +dependencies = [ + "anyhow", + "argon2", + "backtrace", + "base64", + "chacha20poly1305", + "clap", + "clap_complete", + "confy", + "crossterm", + "dirs", + "heck", + "human-panic", + "log", + "log4rs", + "rpassword", + "secrecy", + "serde", + "serde_json", + "serde_with", + "thiserror", + "validator", + "zeroize", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "human-panic" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac63a746b187e95d51fe16850eb04d1cfef203f6af98e6c405a6f262ad3df00a" +dependencies = [ + "anstream", + "anstyle", + "backtrace", + "os_info", + "serde", + "serde_derive", + "toml", + "uuid", +] + +[[package]] +name = "humantime" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" +dependencies = [ + "equivalent", + "hashbrown 0.15.5", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0b063578492ceec17683ef2f8c5e89121fbd0b172cbc280635ab7567db2738" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.175" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" + +[[package]] +name = "libredox" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "litrs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +dependencies = [ + "serde", +] + +[[package]] +name = "log-mdc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" + +[[package]] +name = "log4rs" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e947bb896e702c711fccc2bf02ab2abb6072910693818d1d6b07ee2b9dfd86c" +dependencies = [ + "anyhow", + "arc-swap", + "chrono", + "derive_more", + "fnv", + "humantime", + "libc", + "log", + "log-mdc", + "mock_instant", + "parking_lot", + "rand", + "serde", + "serde-value", + "serde_json", + "serde_yaml", + "thiserror", + "thread-id", + "typemap-ors", + "unicode-segmentation", + "winapi", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "log", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "mock_instant" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce6dd36094cac388f119d2e9dc82dc730ef91c32a6222170d630e5414b956e6" + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "os_info" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3" +dependencies = [ + "log", + "plist", + "serde", + "windows-sys 0.52.0", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "plist" +version = "1.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" +dependencies = [ + "base64", + "indexmap 2.11.0", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "redox_syscall" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror", +] + +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + +[[package]] +name = "rpassword" +version = "7.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d4c8b64f049c6721ec8ccec37ddfc3d641c4a7fca57e8f2a89de509c73df39" +dependencies = [ + "libc", + "rtoolbox", + "windows-sys 0.59.0", +] + +[[package]] +name = "rtoolbox" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cc970b249fbe527d6e02e0a227762c9108b2f49d81094fe357ffc6d14d7f6f" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustix" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.60.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secrecy" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.143" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_with" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.0", + "schemars 0.9.0", + "schemars 1.0.4", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.11.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "terminal_size" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" +dependencies = [ + "rustix", + "windows-sys 0.60.2", +] + +[[package]] +name = "thiserror" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread-id" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99043e46c5a15af379c06add30d9c93a6c0e8849de00d244c4a2c417da128d80" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "time" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_writer", +] + +[[package]] +name = "toml_datetime" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_writer" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" + +[[package]] +name = "typemap-ors" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a68c24b707f02dd18f1e4ccceb9d49f2058c2fb86384ef9972592904d7a28867" +dependencies = [ + "unsafe-any-ors", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "unsafe-any-ors" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a303d30665362d9680d7d91d78b23f5f899504d4f08b3c4cf08d055d87c0ad" +dependencies = [ + "destructure_traitobject", +] + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "validator" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43fb22e1a008ece370ce08a3e9e4447a910e92621bb49b85d6e48a45397e7cfa" +dependencies = [ + "idna", + "once_cell", + "regex", + "serde", + "serde_derive", + "serde_json", + "url", + "validator_derive", +] + +[[package]] +name = "validator_derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7df16e474ef958526d1205f6dda359fdfab79d9aa6d54bafcb92dcd07673dca" +dependencies = [ + "darling", + "once_cell", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.4+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a5f4a424faf49c3c2c344f166f0662341d470ea185e939657aaff130f0ec4a" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1" +dependencies = [ + "unicode-ident", +] + +[[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" + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link 0.1.3", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "wit-bindgen" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36" + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..08bbaf2 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,47 @@ +[package] +name = "gman" +version = "0.1.0" +edition = "2024" +authors = ["Alex Clarke "] +description = "Universal credential management CLI" +keywords = ["cli", "secrets", "credentials", "passwords"] +documentation = "https://github.com/Dark-Alex-17/gman" +repository = "https://github.com/Dark-Alex-17/gman" +homepage = "https://github.com/Dark-Alex-17/gman" +readme = "README.md" +license = "MIT" +rust-version = "1.89.0" +exclude = [".github", "CONTRIBUTING.md", "*.log", "tags"] + +[dependencies] +anyhow = "1.0.99" +argon2 = "0.5.3" +backtrace = "0.3.75" +base64 = "0.22.1" +chacha20poly1305 = { version = "0.10.1", features = ["std"] } +clap = { version = "4.5.47", features = ["cargo", "derive", "env", "wrap_help"] } +clap_complete = "4.5.57" +confy = { version = "1.0.0", default-features = false, features = ["yaml_conf"] } +crossterm = "0.29.0" +dirs = "6.0.0" +human-panic = "2.0.3" +log = "0.4.28" +log4rs = "1.4.0" +rpassword = "7.4.0" +secrecy = "0.10.3" +validator = { version = "0.20.0", features = ["derive"] } +zeroize = "1.8.1" +serde = { version = "1.0.219", features = ["derive"] } +heck = "0.5.0" +thiserror = "2.0.16" +serde_with = "3.14.0" +serde_json = "1.0.143" + +[[bin]] +bench = false +name = "gman" + +[profile.release] +lto = true +strip = true +opt-level = "z" diff --git a/README.md b/README.md index 9a80fe8..d922b73 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,150 @@ # gman -Universal credential management CLI +A universal credential management CLI with a unified interface for all your secret providers. + +`gman` provides a single, consistent set of commands to manage secrets, whether they are stored in a secure local vault or any other supported provider. Switch between providers on the fly, script interactions with JSON output, and manage your secrets with ease. + +## Features + +- **Secure Local Storage**: Out-of-the-box support for a local vault (`~/.config/gman/vault.yml`) with strong encryption using **Argon2id** for key derivation and **XChaCha20-Poly1305** for authenticated encryption. +- **Unified Interface**: A consistent command set (`add`, `get`, `list`, etc.) for every supported provider. +- **Provider Selection**: Explicitly choose a provider for a command using the `--provider` flag. +- **Flexible Output**: Get secrets in plaintext for scripting, structured `json` for applications, or human-readable text. +- **Password Management**: For local secret storage: securely prompts for the vault password. For automation, a password can be supplied via a `~/.gman_password` file, similar to Ansible Vault. +- **Shell Completions**: Generate completion scripts for Bash, Zsh, Fish, and other shells. +- **Standardized Naming**: Secret names are automatically converted to `snake_case` to ensure consistency. + +## Installation + +Ensure you have Rust and Cargo installed. Then, clone the repository and install the binary: + +```sh +git clone https://github.com/Dark-Alex-17/gman.git +cd gman +cargo install --path . +``` + +## Configuration + +`gman` is configured through a YAML file located at `~/.config/gman/config.yml`. + +A default configuration is created automatically. Here is an example: + +```yaml +# ~/.config/gman/config.yml +--- +provider: local +password_file: null # Can be set to a path like /home/user/.gman_password +``` + +### Vault File + +For the `local` provider, secrets are stored in an encrypted vault file at `~/.config/gman/vault.yml`. This file should not be edited manually. + +### Password File + +To avoid being prompted for a password with every command, you can create a file at `~/.gman_password` containing your vault password. `gman` will automatically detect and use this file if it exists. + +```sh +# Create the password file with the correct permissions +echo "your-super-secret-password" > ~/.gman_password +chmod 600 ~/.gman_password +``` + +## Usage + +`gman` uses simple commands to manage secrets. Secret values are passed via `stdin`. + +### Commands + +**1. Add a Secret** + +To add a new secret, use the `add` command. You will be prompted to enter the secret value, followed by `Ctrl-D` to save. + +```sh +gman add my_api_key +``` +``` +Enter the text to encrypt, then press Ctrl-D twice to finish input +this-is-my-secret-api-key +^D +✓ Secret 'my_api_key' added to the vault. +``` + +You can also pipe the value directly: +```sh +echo "this-is-my-secret-api-key" | gman add my_api_key +``` + +**2. Get a Secret** + +Retrieve a secret's plaintext value with the `get` command. + +```sh +gman get my_api_key +``` +``` +this-is-my-secret-api-key +``` + +**3. Get a Secret as JSON** + +Use the `--output json` flag to get the secret in a structured format. + +```sh +gman get my_api_key --output json +``` +``` +{ + "my_api_key": "this-is-my-secret-api-key" +} +``` + +**4. List Secrets** + +List the names of all secrets in the vault. + +```sh +gman list +``` +``` +Secrets in the vault: +- my_api_key +- another_secret +``` + +**5. Update a Secret** + +Update an existing secret's value. + +```sh +echo "new-secret-value" | gman update my_api_key +``` +``` +✓ Secret 'my_api_key' updated in the vault. +``` + +**6. Delete a Secret** + +Remove a secret from the vault. + +```sh +gman delete my_api_key +``` +``` +✓ Secret 'my_api_key' deleted from the vault. +``` + +**7. Generate Shell Completions** + +Create a completion script for your shell to enable auto-complete for commands and arguments. + +```sh +# For Bash +gman completions bash > /etc/bash_completion.d/gman + +# For Zsh +gman completions zsh > /usr/local/share/zsh/site-functions/_gman +``` + +## Creator +* [Alex Clarke](https://github.com/Dark-Alex-17) \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..ca0b564 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,10 @@ +tab_spaces=4 +edition = "2021" +reorder_imports = true +imports_granularity = "Crate" +group_imports = "StdExternalCrate" +reorder_modules = true +merge_derives = true +use_field_init_shorthand = true +format_macro_matchers = true +format_macro_bodies = true \ No newline at end of file diff --git a/src/bin/gman/main.rs b/src/bin/gman/main.rs new file mode 100644 index 0000000..856d83e --- /dev/null +++ b/src/bin/gman/main.rs @@ -0,0 +1,278 @@ +use clap::{ + CommandFactory, Parser, ValueEnum, crate_authors, crate_description, crate_name, crate_version, +}; + +use anyhow::{Context, Result}; +use clap::Subcommand; +use crossterm::execute; +use crossterm::terminal::{LeaveAlternateScreen, disable_raw_mode}; +use gman::config::Config; +use gman::providers::SupportedProvider; +use gman::providers::local::LocalProvider; +use heck::ToSnakeCase; +use std::io::{self, IsTerminal, Read, Write}; +use std::panic; +use std::panic::PanicHookInfo; + +mod utils; + +#[derive(Debug, Clone, ValueEnum)] +enum OutputFormat { + Text, + Json, +} + +#[derive(Debug, Clone, ValueEnum)] +#[clap(rename_all = "lower")] +pub enum ProviderKind { + Local, +} + +impl From for SupportedProvider { + fn from(k: ProviderKind) -> Self { + match k { + ProviderKind::Local => SupportedProvider::Local(LocalProvider::default()), + } + } +} + +#[derive(Debug, Parser)] +#[command( + name = crate_name!(), + author = crate_authors!(), + version = crate_version!(), + about = crate_description!(), + help_template = "\ +{before-help}{name} {version} +{author-with-newline} +{about-with-newline} +{usage-heading} {usage} + +{all-args}{after-help}" +)] +struct Cli { + /// Specify the output format + #[arg(short, long, value_enum)] + output: Option, + + /// Specify the secret provider to use (defaults to 'provider' in config or 'local') + #[arg(long, value_enum)] + provider: Option, + + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand, Debug)] +enum Commands { + /// Add a secret to the configured secret provider + Add { + /// Name of the secret to store + name: String, + }, + + /// Decrypt a secret and print the plaintext + Get { + /// Name of the secret to retrieve + name: String, + }, + + /// Update an existing secret in the configured secret provider + Update { + /// Name of the secret to update + name: String, + }, + + /// Delete a secret from the configured secret provider + Delete { + /// Name of the secret to delete + name: String, + }, + + /// List all secrets stored in the configured secret provider + List {}, + + /// Generate shell completion scripts + Completions { + /// The shell to generate the script for + #[arg(value_enum)] + shell: clap_complete::Shell, + }, +} + +fn main() -> Result<()> { + log4rs::init_config(utils::init_logging_config())?; + panic::set_hook(Box::new(|info| { + panic_hook(info); + })); + let cli = Cli::parse(); + let config = load_config(&cli)?; + let secrets_provider = config.extract_provider(); + + match cli.command { + Commands::Add { name } => { + let plaintext = + read_all_stdin().with_context(|| "unable to read plaintext from stdin")?; + let snake_case_name = name.to_snake_case(); + secrets_provider + .set_secret(&config, &snake_case_name, plaintext.trim_end()) + .map(|_| match cli.output { + Some(_) => (), + None => println!("✓ Secret '{snake_case_name}' added to the vault."), + })?; + } + Commands::Get { name } => { + let snake_case_name = name.to_snake_case(); + secrets_provider + .get_secret(&config, &snake_case_name) + .map(|secret| match cli.output { + Some(OutputFormat::Json) => { + let json_output = serde_json::json!({ + snake_case_name: secret + }); + println!( + "{}", + serde_json::to_string_pretty(&json_output) + .expect("failed to serialize secret to JSON") + ); + } + Some(OutputFormat::Text) | None => { + println!("{}", secret); + } + })?; + } + Commands::Update { name } => { + let plaintext = + read_all_stdin().with_context(|| "unable to read plaintext from stdin")?; + let snake_case_name = name.to_snake_case(); + secrets_provider + .update_secret(&config, &snake_case_name, plaintext.trim_end()) + .map(|_| match cli.output { + Some(_) => (), + None => println!("✓ Secret '{snake_case_name}' updated in the vault."), + })?; + } + Commands::Delete { name } => { + let snake_case_name = name.to_snake_case(); + secrets_provider + .delete_secret(&snake_case_name) + .map(|_| match cli.output { + None => println!("✓ Secret '{snake_case_name}' deleted from the vault."), + Some(_) => (), + })?; + } + Commands::List {} => { + let secrets = secrets_provider.list_secrets()?; + if secrets.is_empty() { + match cli.output { + Some(OutputFormat::Json) => { + let json_output = serde_json::json!([]); + println!("{}", serde_json::to_string_pretty(&json_output)?); + } + Some(OutputFormat::Text) => (), + None => println!("The vault is empty."), + } + } else { + match cli.output { + Some(OutputFormat::Json) => { + let json_output = serde_json::json!(secrets); + println!("{}", serde_json::to_string_pretty(&json_output)?); + return Ok(()); + } + Some(OutputFormat::Text) => { + for key in &secrets { + println!("- {}", key); + } + } + None => { + println!("Secrets in the vault:"); + for key in &secrets { + println!("- {}", key); + } + } + } + } + } + Commands::Completions { shell } => { + let mut cmd = Cli::command(); + let bin_name = cmd.get_name().to_string(); + clap_complete::generate(shell, &mut cmd, bin_name, &mut io::stdout()); + } + } + + Ok(()) +} + +fn load_config(cli: &Cli) -> Result { + let mut config: Config = confy::load("gman", "config")?; + if let Some(local_password_file) = Config::local_provider_password_file() { + config.password_file = Some(local_password_file); + } + + if let Some(provider_kind) = &cli.provider { + let provider: SupportedProvider = provider_kind.clone().into(); + config.provider = provider.into(); + } + + Ok(config) +} + +fn read_all_stdin() -> Result { + if io::stdin().is_terminal() { + #[cfg(not(windows))] + eprintln!("Enter the text to encrypt, then press Ctrl-D twice to finish input"); + #[cfg(windows)] + eprintln!("Enter the text to encrypt, then press Ctrl-Z to finish input"); + io::stderr().flush()?; + } + let mut buf = String::new(); + let stdin_tty = io::stdin().is_terminal(); + let stdout_tty = io::stdout().is_terminal(); + io::stdin().read_to_string(&mut buf)?; + + if stdin_tty && stdout_tty && !buf.ends_with('\n') { + let mut out = io::stdout().lock(); + out.write_all(b"\n")?; + out.flush()?; + } + Ok(buf) +} + +#[cfg(debug_assertions)] +fn panic_hook(info: &PanicHookInfo<'_>) { + use backtrace::Backtrace; + use crossterm::style::Print; + + let location = info.location().unwrap(); + + let msg = match info.payload().downcast_ref::<&'static str>() { + Some(s) => *s, + None => match info.payload().downcast_ref::() { + Some(s) => &s[..], + None => "Box", + }, + }; + + let stacktrace: String = format!("{:?}", Backtrace::new()).replace('\n', "\n\r"); + + disable_raw_mode().unwrap(); + execute!( + io::stdout(), + LeaveAlternateScreen, + Print(format!( + "thread '' panicked at '{msg}', {location}\n\r{stacktrace}" + )), + ) + .unwrap(); +} + +#[cfg(not(debug_assertions))] +fn panic_hook(info: &PanicHookInfo<'_>) { + use human_panic::{handle_dump, metadata, print_msg}; + + let meta = metadata!(); + let file_path = handle_dump(&meta, info); + disable_raw_mode().unwrap(); + execute!(io::stdout(), LeaveAlternateScreen).unwrap(); + print_msg(file_path, &meta).expect("human-panic: printing error message to console failed"); +} diff --git a/src/bin/gman/utils.rs b/src/bin/gman/utils.rs new file mode 100644 index 0000000..bc15d19 --- /dev/null +++ b/src/bin/gman/utils.rs @@ -0,0 +1,43 @@ +use std::fs; +use std::path::PathBuf; +use log4rs::append::file::FileAppender; +use log4rs::config::{Appender, Root}; +use log4rs::encode::pattern::PatternEncoder; +use log::LevelFilter; + +pub fn init_logging_config() -> log4rs::Config { + let logfile = FileAppender::builder() + .encoder(Box::new(PatternEncoder::new( + "{d(%Y-%m-%d %H:%M:%S%.3f)(utc)} <{i}> [{l}] {f}:{L} - {m}{n}", + ))) + .build(get_log_path()) + .unwrap(); + + log4rs::Config::builder() + .appender(Appender::builder().build("logfile", Box::new(logfile))) + .build( + Root::builder() + .appender("logfile") + .build(LevelFilter::Debug), + ) + .unwrap() +} + +pub fn get_log_path() -> PathBuf { + let mut log_path = if cfg!(target_os = "linux") { + dirs::cache_dir().unwrap_or_else(|| PathBuf::from("~/.cache")) + } else if cfg!(target_os = "macos") { + dirs::home_dir().unwrap().join("Library/Logs") + } else { + dirs::data_local_dir().unwrap_or_else(|| PathBuf::from("C:\\Logs")) + }; + + log_path.push("gman"); + + if let Err(e) = fs::create_dir_all(&log_path) { + eprintln!("Failed to create log directory: {e:?}"); + } + + log_path.push("gman.log"); + log_path +} \ No newline at end of file diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..5ed9c00 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,46 @@ +use crate::providers::{SecretProvider, SupportedProvider}; +use serde::{Deserialize, Serialize}; +use serde_with::DisplayFromStr; +use serde_with::serde_as; +use std::path::PathBuf; +use log::{debug}; +use validator::Validate; + +#[serde_as] +#[derive(Debug, Validate, Serialize, Deserialize)] +pub struct Config { + #[serde_as(as = "DisplayFromStr")] + pub provider: SupportedProvider, + pub password_file: Option, +} + +impl Default for Config { + fn default() -> Self { + Self { + provider: SupportedProvider::Local(Default::default()), + password_file: Config::local_provider_password_file(), + } + } +} + +impl Config { + pub fn extract_provider(&self) -> Box<&dyn SecretProvider> { + match &self.provider { + SupportedProvider::Local(p) => { + debug!("Using local secret provider"); + Box::new(p) + } + } + } + + pub fn local_provider_password_file() -> Option { + let mut path = dirs::home_dir().map(|p| p.join(".gman_password")); + if let Some(p) = &path { + if !p.exists() { + path = None; + } + } + + path + } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..2e98f6b --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,197 @@ +use anyhow::{anyhow, bail, Context, Result}; +use argon2::{ + password_hash::{rand_core::RngCore, SaltString}, + Algorithm, Argon2, Params, PasswordHasher, Version, +}; +use base64::{engine::general_purpose::STANDARD as B64, Engine as _}; +use chacha20poly1305::{ + aead::{Aead, KeyInit, OsRng}, + Key, XChaCha20Poly1305, XNonce, +}; +use secrecy::{ExposeSecret, SecretString}; +use zeroize::Zeroize; +pub mod providers; +pub mod config; + +pub (in crate) const HEADER: &str = "$VAULT"; +pub (in crate) const VERSION: &str = "v1"; +pub (in crate) const KDF: &str = "argon2id"; + +pub (in crate) const ARGON_M_COST_KIB: u32 = 19_456; +pub (in crate) const ARGON_T_COST: u32 = 2; +pub (in crate) const ARGON_P: u32 = 1; + +pub (in crate) const SALT_LEN: usize = 16; +pub (in crate) const NONCE_LEN: usize = 24; +pub (in crate) const KEY_LEN: usize = 32; + +fn derive_key(password: &SecretString, salt: &SaltString) -> Result<(Key, String)> { + let params = Params::new(ARGON_M_COST_KIB, ARGON_T_COST, ARGON_P, Some(KEY_LEN)) + .map_err(|e| anyhow!("argon2 params error: {:?}", e))?; + let argon = Argon2::new(Algorithm::Argon2id, Version::V0x13, params); + + let phc = argon + .hash_password(password.expose_secret().as_bytes(), salt) + .map_err(|e| anyhow!("argon2 hash error: {:?}", e))? + .to_string(); + + let mut key_bytes = [0u8; KEY_LEN]; + argon + .hash_password_into( + password.expose_secret().as_bytes(), + salt.to_string().as_bytes(), + &mut key_bytes, + ) + .map_err(|e| anyhow!("argon2 into error: {:?}", e))?; + + key_bytes.zeroize(); + let key = Key::from_slice(&key_bytes); + Ok((*key, phc)) +} + +pub fn encrypt_string(password: impl Into, plaintext: &str) -> Result { + let password = password.into(); + + let salt = SaltString::generate(&mut OsRng); + let mut nonce_bytes = [0u8; NONCE_LEN]; + OsRng.fill_bytes(&mut nonce_bytes); + + let (key, _phc) = derive_key(&password, &salt)?; + let cipher = XChaCha20Poly1305::new(&key); + + let aad = format!("{};{}", HEADER, VERSION); + + let nonce = XNonce::from_slice(&nonce_bytes); + let mut pt = plaintext.as_bytes().to_vec(); + let ct = cipher + .encrypt( + nonce, + chacha20poly1305::aead::Payload { + msg: &pt, + aad: aad.as_bytes(), + }, + ) + .map_err(|_| anyhow!("encryption failed"))?; + + pt.zeroize(); + + let env = format!( + "{};{};{};m={m},t={t},p={p};salt={salt};nonce={nonce};ct={ct}", + HEADER, + VERSION, + KDF, + m = ARGON_M_COST_KIB, + t = ARGON_T_COST, + p = ARGON_P, + salt = B64.encode(salt.to_string().as_bytes()), + nonce = B64.encode(nonce_bytes), + ct = B64.encode(&ct), + ); + + drop(cipher); + let _ = key; + nonce_bytes.zeroize(); + + Ok(env) +} + +pub fn decrypt_string(password: impl Into, envelope: &str) -> Result { + let password = password.into(); + + let parts: Vec<&str> = envelope.split(';').collect(); + if parts.len() < 7 { + bail!("invalid envelope format"); + } + if parts[0] != HEADER { + bail!("unexpected header"); + } + if parts[1] != VERSION { + bail!("unsupported version {}", parts[1]); + } + if parts[2] != KDF { + bail!("unsupported kdf {}", parts[2]); + } + + let params_str = parts[3]; + let mut m = ARGON_M_COST_KIB; + let mut t = ARGON_T_COST; + let mut p = ARGON_P; + for kv in params_str.split(',') { + if let Some((k, v)) = kv.split_once('=') { + match k { + "m" => m = v.parse().unwrap_or(m), + "t" => t = v.parse().unwrap_or(t), + "p" => p = v.parse().unwrap_or(p), + _ => {} + } + } + } + + let salt_b64 = parts[4].strip_prefix("salt=").context("missing salt")?; + let nonce_b64 = parts[5].strip_prefix("nonce=").context("missing nonce")?; + let ct_b64 = parts[6].strip_prefix("ct=").context("missing ct")?; + + let salt_bytes = B64.decode(salt_b64).context("bad salt b64")?; + let mut nonce_bytes = B64.decode(nonce_b64).context("bad nonce b64")?; + let mut ct = B64.decode(ct_b64).context("bad ct b64")?; + + if nonce_bytes.len() != NONCE_LEN { + bail!("nonce length mismatch"); + } + + let params = + Params::new(m, t, p, Some(KEY_LEN)).map_err(|e| anyhow!("argon2 params error: {:?}", e))?; + let argon = Argon2::new(Algorithm::Argon2id, Version::V0x13, params); + + let mut key_bytes = [0u8; KEY_LEN]; + argon + .hash_password_into( + password.expose_secret().as_bytes(), + &salt_bytes, + &mut key_bytes, + ) + .map_err(|e| anyhow!("argon2 derive error: {:?}", e))?; + let key_clone = key_bytes; + let key = Key::from_slice(&key_clone); + key_bytes.zeroize(); + + let cipher = XChaCha20Poly1305::new(key); + + let aad = format!("{};{}", HEADER, VERSION); + let nonce = XNonce::from_slice(&nonce_bytes); + let pt = cipher + .decrypt( + nonce, + chacha20poly1305::aead::Payload { + msg: &ct, + aad: aad.as_bytes(), + }, + ) + .map_err(|_| anyhow!("decryption failed (wrong password or corrupted data)"))?; + + nonce_bytes.zeroize(); + ct.zeroize(); + + let s = String::from_utf8(pt).context("plaintext not valid UTF-8")?; + Ok(s) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn round_trip() { + let pw = SecretString::new("correct horse battery staple".into()); + let msg = "swordfish"; + let env = encrypt_string(pw.clone(), msg).unwrap(); + let out = decrypt_string(pw, &env).unwrap(); + assert_eq!(msg, out); + } + + #[test] + fn wrong_password_fails() { + let env = encrypt_string(SecretString::new("pw1".into()), "hello").unwrap(); + assert!(decrypt_string(SecretString::new("pw2".into()), &env).is_err()); + } +} diff --git a/src/providers/local.rs b/src/providers/local.rs new file mode 100644 index 0000000..3f2f01c --- /dev/null +++ b/src/providers/local.rs @@ -0,0 +1,274 @@ +use anyhow::{Context, anyhow, bail}; +use secrecy::{ExposeSecret, SecretString}; +use std::collections::HashMap; +use std::fs; +use zeroize::Zeroize; + +use crate::config::Config; +use crate::providers::SecretProvider; +use crate::{ + ARGON_M_COST_KIB, ARGON_P, ARGON_T_COST, HEADER, KDF, KEY_LEN, NONCE_LEN, SALT_LEN, VERSION, +}; +use anyhow::Result; +use argon2::{Algorithm, Argon2, Params, Version}; +use base64::{Engine as _, engine::general_purpose::STANDARD as B64}; +use chacha20poly1305::aead::rand_core::RngCore; +use chacha20poly1305::{ + Key, XChaCha20Poly1305, XNonce, + aead::{Aead, KeyInit, OsRng}, +}; +use log::{debug, error}; +use serde::Deserialize; + +#[derive(Debug, Clone)] +pub struct LocalProviderConfig { + pub vault_path: String, +} + +impl Default for LocalProviderConfig { + fn default() -> Self { + Self { + vault_path: dirs::home_dir() + .map(|p| p.join(".gman_vault")) + .and_then(|p| p.to_str().map(|s| s.to_string())) + .unwrap_or_else(|| ".gman_vault".into()), + } + } +} + +#[derive(Debug, Default, Deserialize)] +pub struct LocalProvider; + +impl SecretProvider for LocalProvider { + fn get_secret(&self, config: &Config, key: &str) -> Result { + let vault: HashMap = confy::load("gman", "vault").unwrap_or_default(); + let envelope = vault + .get(key) + .with_context(|| format!("key '{key}' not found in the vault"))?; + + let password = get_password(&config)?; + let plaintext = decrypt_string(&password, envelope)?; + drop(password); + + Ok(plaintext) + } + + fn set_secret(&self, config: &Config, key: &str, value: &str) -> Result<()> { + let mut vault: HashMap = confy::load("gman", "vault").unwrap_or_default(); + if vault.contains_key(key) { + error!( + "Key '{key}' already exists in the vault. Use a different key or delete the existing one first." + ); + bail!("key '{key}' already exists"); + } + + let password = get_password(&config)?; + let envelope = encrypt_string(&password, value)?; + drop(password); + + vault.insert(key.to_string(), envelope); + + confy::store("gman", "vault", vault) + .with_context(|| "failed to save secret to the vault") + } + + fn update_secret(&self, config: &Config, key: &str, value: &str) -> Result<()> { + let mut vault: HashMap = confy::load("gman", "vault").unwrap_or_default(); + + let password = get_password(&config)?; + let envelope = encrypt_string(&password, value)?; + drop(password); + + if vault.contains_key(key) { + debug!("Key '{key}' exists in vault. Overwriting previous value"); + let vault_entry = vault + .get_mut(key) + .with_context(|| format!("key '{key}' not found in the vault"))?; + *vault_entry = envelope; + + return Ok(()); + } + + vault.insert(key.to_string(), envelope); + confy::store("gman", "vault", vault).with_context(|| "failed to save secret to the vault") + } + + fn delete_secret(&self, key: &str) -> Result<()> { + let mut vault: HashMap = confy::load("gman", "vault").unwrap_or_default(); + if !vault.contains_key(key) { + error!("Key '{key}' does not exist in the vault."); + bail!("key '{key}' does not exist"); + } + + vault.remove(key); + confy::store("gman", "vault", vault).with_context(|| "failed to save secret to the vault") + } + + fn list_secrets(&self) -> Result> { + let vault: HashMap = confy::load("gman", "vault").unwrap_or_default(); + let keys: Vec = vault.keys().cloned().collect(); + + Ok(keys) + } +} + +fn encrypt_string(password: &SecretString, plaintext: &str) -> Result { + let mut salt = [0u8; SALT_LEN]; + OsRng.fill_bytes(&mut salt); + let mut nonce_bytes = [0u8; NONCE_LEN]; + OsRng.fill_bytes(&mut nonce_bytes); + + let key = derive_key(password, &salt)?; + let cipher = XChaCha20Poly1305::new(&key); + let aad = format!("{};{}", HEADER, VERSION); + + let nonce = XNonce::from_slice(&nonce_bytes); + let mut pt = plaintext.as_bytes().to_vec(); + let ct = cipher + .encrypt( + nonce, + chacha20poly1305::aead::Payload { + msg: &pt, + aad: aad.as_bytes(), + }, + ) + .map_err(|_| anyhow!("encryption failed"))?; + pt.zeroize(); + + let env = format!( + "{};{};{};m={m},t={t},p={p};salt={salt};nonce={nonce};ct={ct}", + HEADER, + VERSION, + KDF, + m = ARGON_M_COST_KIB, + t = ARGON_T_COST, + p = ARGON_P, + salt = B64.encode(salt), + nonce = B64.encode(nonce_bytes), + ct = B64.encode(&ct), + ); + + drop(cipher); + salt.zeroize(); + nonce_bytes.zeroize(); + + Ok(env) +} + +fn derive_key_with_params( + password: &SecretString, + salt: &[u8], + m_cost: u32, + t_cost: u32, + p: u32, +) -> Result { + let params = Params::new(m_cost, t_cost, p, Some(KEY_LEN)) + .map_err(|e| anyhow!("argon2 params error: {:?}", e))?; + let argon = Argon2::new(Algorithm::Argon2id, Version::V0x13, params); + let mut key_bytes = [0u8; KEY_LEN]; + argon + .hash_password_into(password.expose_secret().as_bytes(), salt, &mut key_bytes) + .map_err(|e| anyhow!("argon2 derive error: {:?}", e))?; + key_bytes.zeroize(); + let key = Key::from_slice(&key_bytes); + Ok(*key) +} + +fn derive_key(password: &SecretString, salt: &[u8]) -> Result { + derive_key_with_params(password, salt, ARGON_M_COST_KIB, ARGON_T_COST, ARGON_P) +} + +fn decrypt_string(password: &SecretString, envelope: &str) -> Result { + let parts: Vec<&str> = envelope.trim().split(';').collect(); + if parts.len() < 7 { + debug!("Invalid envelope format: {:?}", parts); + bail!("invalid envelope format"); + } + if parts[0] != HEADER { + debug!("Invalid header: {}", parts[0]); + bail!("unexpected header"); + } + if parts[1] != VERSION { + debug!("Unsupported version: {}", parts[1]); + bail!("unsupported version {}", parts[1]); + } + if parts[2] != KDF { + debug!("Unsupported kdf: {}", parts[2]); + bail!("unsupported kdf {}", parts[2]); + } + + let params_str = parts[3]; + let mut m = ARGON_M_COST_KIB; + let mut t = ARGON_T_COST; + let mut p = ARGON_P; + for kv in params_str.split(',') { + if let Some((k, v)) = kv.split_once('=') { + match k { + "m" => m = v.parse().unwrap_or(m), + "t" => t = v.parse().unwrap_or(t), + "p" => p = v.parse().unwrap_or(p), + _ => {} + } + } + } + + let salt_b64 = parts[4] + .strip_prefix("salt=") + .with_context(|| "missing salt")?; + let nonce_b64 = parts[5] + .strip_prefix("nonce=") + .with_context(|| "missing nonce")?; + let ct_b64 = parts[6].strip_prefix("ct=").with_context(|| "missing ct")?; + + let mut salt = B64.decode(salt_b64).with_context(|| "bad salt b64")?; + let mut nonce_bytes = B64.decode(nonce_b64).with_context(|| "bad nonce b64")?; + let mut ct = B64.decode(ct_b64).with_context(|| "bad ct b64")?; + + if salt.len() != SALT_LEN || nonce_bytes.len() != NONCE_LEN { + debug!( + "Salt/nonce length mismatch: salt {}, nonce {}", + salt.len(), + nonce_bytes.len() + ); + bail!("salt/nonce length mismatch"); + } + + let key = derive_key_with_params(password, &salt, m, t, p)?; + let cipher = XChaCha20Poly1305::new(&key); + let aad = format!("{};{}", HEADER, VERSION); + let nonce = XNonce::from_slice(&nonce_bytes); + + let pt = cipher + .decrypt( + nonce, + chacha20poly1305::aead::Payload { + msg: &ct, + aad: aad.as_bytes(), + }, + ) + .map_err(|_| anyhow!("decryption failed (wrong password or corrupted data)"))?; + + salt.zeroize(); + nonce_bytes.zeroize(); + ct.zeroize(); + + let s = String::from_utf8(pt).with_context(|| "plaintext not valid UTF-8")?; + Ok(s) +} + +fn get_password(config: &Config) -> Result { + if let Some(password_file) = &config.password_file { + let password = SecretString::new( + fs::read_to_string(&password_file) + .with_context(|| format!("failed to read password file {:?}", password_file))? + .trim() + .to_string() + .into(), + ); + + Ok(password) + } else { + let password = rpassword::prompt_password("\nPassword: ")?; + Ok(SecretString::new(password.into())) + } +} diff --git a/src/providers/mod.rs b/src/providers/mod.rs new file mode 100644 index 0000000..64c0cac --- /dev/null +++ b/src/providers/mod.rs @@ -0,0 +1,48 @@ +pub mod local; + +use crate::config::Config; +use crate::providers::local::LocalProvider; +use anyhow::Result; +use serde::{Deserialize}; +use std::fmt::{Display, Formatter}; +use std::str::FromStr; +use thiserror::Error; + +pub trait SecretProvider { + fn get_secret(&self, config: &Config, key: &str) -> Result; + fn set_secret(&self, config: &Config, key: &str, value: &str) -> Result<()>; + fn update_secret(&self, config: &Config, key: &str, value: &str) -> Result<()>; + fn delete_secret(&self, key: &str) -> Result<()>; + fn list_secrets(&self) -> Result>; + // fn sync(&self, config: &config) -> Result<()>; +} + +#[derive(Debug, Error)] +pub enum ParseProviderError { + #[error("unsupported provider '{0}'")] + Unsupported(String), +} + +#[derive(Debug, Deserialize)] +pub enum SupportedProvider { + Local(LocalProvider), +} + +impl FromStr for SupportedProvider { + type Err = ParseProviderError; + + fn from_str(s: &str) -> Result { + match s.trim().to_lowercase().as_str() { + "local" => Ok(SupportedProvider::Local(LocalProvider)), + _ => Err(ParseProviderError::Unsupported(s.to_string())), + } + } +} + +impl Display for SupportedProvider { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + SupportedProvider::Local(_) => write!(f, "local"), + } + } +}