From 5c8749c2a2a86261ab044b84e4def7fa30afab23 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 2 Dec 2020 12:29:03 +0900 Subject: [PATCH] Use `rust-argon2` instead of less-maintained `argonautica` (#389) --- Cargo.lock | 405 +++++++++----------------------- simple-auth-server/Cargo.toml | 3 +- simple-auth-server/README.md | 2 +- simple-auth-server/src/utils.rs | 28 +-- 4 files changed, 132 insertions(+), 306 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2596ef2..d599aaf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,7 +231,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" dependencies = [ - "quote 1.0.7", + "quote", "syn", ] @@ -424,7 +424,7 @@ dependencies = [ "diesel", "dotenv", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "log", "serde 1.0.117", "serde_json", @@ -514,8 +514,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -526,7 +526,7 @@ dependencies = [ "actix-cors 0.5.3", "actix-web", "env_logger 0.8.2", - "futures 0.3.8", + "futures", "serde 1.0.117", "serde_json", ] @@ -537,8 +537,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -550,7 +550,7 @@ dependencies = [ "actix-redis", "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "redis-async", "serde 1.0.117", ] @@ -681,28 +681,6 @@ version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7" -[[package]] -name = "argonautica" -version = "0.2.1" -source = "git+https://github.com/bcmyers/argonautica?rev=67fc8d8d7d67696cd8ca7a59b92531f06b089212#67fc8d8d7d67696cd8ca7a59b92531f06b089212" -dependencies = [ - "base64 0.10.1", - "bindgen", - "bitflags", - "cc", - "cfg-if 0.1.10", - "failure", - "futures 0.1.30", - "futures-cpupool", - "libc", - "log", - "nom 5.1.2", - "num_cpus", - "rand", - "scopeguard", - "tempfile", -] - [[package]] name = "arrayref" version = "0.3.6" @@ -743,8 +721,8 @@ checksum = "e1012c270085fa35ece6a48a569544fde85b6d9ee41074c7b706cc912a03f939" dependencies = [ "askama_shared", "nom 5.1.2", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -881,8 +859,8 @@ dependencies = [ "async-graphql-parser", "darling", "proc-macro-crate", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "thiserror", ] @@ -982,8 +960,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -999,8 +977,8 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -1021,7 +999,7 @@ dependencies = [ "actix-web", "env_logger 0.7.1", "failure", - "futures 0.3.8", + "futures", "num_cpus", "r2d2", "r2d2_sqlite", @@ -1039,7 +1017,7 @@ dependencies = [ "actix-web", "bytes 0.5.6", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "serde 1.0.117", "serde_json", "time 0.1.44", @@ -1115,7 +1093,7 @@ version = "2.0.0" dependencies = [ "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "serde 1.0.117", "serde_json", "validator", @@ -1160,15 +1138,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - [[package]] name = "base64" version = "0.11.0" @@ -1220,29 +1189,6 @@ dependencies = [ "serde 1.0.117", ] -[[package]] -name = "bindgen" -version = "0.50.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0e5a5f74b2bafe0b39379f616b5975e08bcaca4e779c078d5c31324147e9ba" -dependencies = [ - "bitflags", - "cexpr", - "cfg-if 0.1.10", - "clang-sys", - "clap", - "env_logger 0.6.2", - "fxhash", - "lazy_static", - "log", - "peeking_take_while", - "proc-macro2 0.4.30", - "quote 0.6.13", - "regex", - "shlex", - "which", -] - [[package]] name = "bitflags" version = "1.2.1" @@ -1455,18 +1401,6 @@ name = "cc" version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cexpr" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" -dependencies = [ - "nom 4.2.3", -] [[package]] name = "cfg-if" @@ -1513,17 +1447,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "clang-sys" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.33.3" @@ -1830,8 +1753,8 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "strsim 0.9.3", "syn", ] @@ -1843,7 +1766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", - "quote 1.0.7", + "quote", "syn", ] @@ -1870,7 +1793,7 @@ dependencies = [ "async-trait", "config", "deadpool", - "futures 0.3.8", + "futures", "log", "serde 1.0.117", "tokio", @@ -1885,8 +1808,8 @@ checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" dependencies = [ "darling", "derive_builder_core", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -1897,8 +1820,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" dependencies = [ "darling", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -1908,8 +1831,8 @@ version = "0.99.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -1919,8 +1842,8 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64196eb9f551916167225134f1e8a90f0b5774331d3c900d6328fd94bafe3544" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -1955,7 +1878,7 @@ dependencies = [ "dotenv", "env_logger 0.7.1", "failure", - "futures 0.3.8", + "futures", "r2d2", "serde 1.0.117", "serde_json", @@ -1968,8 +1891,8 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -2150,24 +2073,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" dependencies = [ "heck", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] -[[package]] -name = "env_logger" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" -dependencies = [ - "atty", - "humantime 1.3.0", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.7.1" @@ -2236,8 +2146,8 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "synstructure", ] @@ -2348,12 +2258,6 @@ dependencies = [ "new_debug_unreachable", ] -[[package]] -name = "futures" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" - [[package]] name = "futures" version = "0.3.8" @@ -2385,16 +2289,6 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" -[[package]] -name = "futures-cpupool" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" -dependencies = [ - "futures 0.1.30", - "num_cpus", -] - [[package]] name = "futures-executor" version = "0.3.8" @@ -2434,8 +2328,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -2528,12 +2422,6 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "globset" version = "0.4.6" @@ -2868,7 +2756,7 @@ checksum = "1563b111bd1337885303dc431bc52f23ac0f48ca9d2ac73da423749d547ac6c8" dependencies = [ "autocfg", "derive_utils", - "quote 1.0.7", + "quote", "syn", ] @@ -2920,15 +2808,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" -[[package]] -name = "jobserver" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.45" @@ -2952,7 +2831,7 @@ dependencies = [ "actix-service", "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "json", "serde 1.0.117", "serde_json", @@ -2983,7 +2862,7 @@ dependencies = [ "actix-web", "bytes 0.5.6", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "log", "serde 1.0.117", "serde_json", @@ -3041,8 +2920,8 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d40af234d8e971a9d7dda93ffbcc8a44a93f17e69e3067f72ce7a6894c41d51b" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -3126,16 +3005,6 @@ version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi 0.3.9", -] - [[package]] name = "libsqlite3-sys" version = "0.17.3" @@ -3297,7 +3166,7 @@ dependencies = [ "actix-service", "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "pin-project 0.4.27", ] @@ -3400,7 +3269,7 @@ dependencies = [ "bytes 0.5.6", "derive_more", "encoding_rs", - "futures 0.3.8", + "futures", "http", "httparse", "lazy_static", @@ -3417,7 +3286,7 @@ dependencies = [ "actix-multipart", "actix-web", "async-std", - "futures 0.3.8", + "futures", "sanitize-filename", ] @@ -3427,7 +3296,7 @@ version = "0.3.0" dependencies = [ "actix-multipart", "actix-web", - "futures 0.3.8", + "futures", "sanitize-filename", ] @@ -3439,7 +3308,7 @@ dependencies = [ "actix-web", "bytes 0.5.6", "dotenv", - "futures 0.3.8", + "futures", "rusoto_core", "rusoto_s3", "sanitize-filename", @@ -3772,12 +3641,6 @@ dependencies = [ "regex", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -3811,8 +3674,8 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -3889,8 +3752,8 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -3900,8 +3763,8 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -4058,22 +3921,13 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] - [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid", ] [[package]] @@ -4082,7 +3936,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d32df793782c132f437089d84b487d617a0baac886fa8519751dca07db9266e0" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid", ] [[package]] @@ -4103,8 +3957,8 @@ checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" dependencies = [ "anyhow", "itertools", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -4133,22 +3987,13 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - [[package]] name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2", ] [[package]] @@ -4448,7 +4293,7 @@ dependencies = [ "async-trait", "base64 0.12.3", "bytes 0.5.6", - "futures 0.3.8", + "futures", "hmac 0.7.1", "http", "hyper", @@ -4477,7 +4322,7 @@ dependencies = [ "async-trait", "chrono", "dirs 2.0.2", - "futures 0.3.8", + "futures", "hyper", "pin-project 0.4.27", "regex", @@ -4496,7 +4341,7 @@ checksum = "2b6bc3221ae5a2c036d5757eee68a2ffb6b7f87b8a83adbf4271c8133fdee01c" dependencies = [ "async-trait", "bytes 0.5.6", - "futures 0.3.8", + "futures", "rusoto_core", "xml-rs", ] @@ -4509,7 +4354,7 @@ checksum = "62940a2bd479900a1bf8935b8f254d3e19368ac3ac4570eb4bd48eb46551a1b7" dependencies = [ "base64 0.12.3", "bytes 0.5.6", - "futures 0.3.8", + "futures", "hex", "hmac 0.7.1", "http", @@ -4762,8 +4607,8 @@ version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -4806,7 +4651,7 @@ version = "1.0.0" dependencies = [ "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "tokio", ] @@ -4884,7 +4729,7 @@ version = "2.0.0" dependencies = [ "actix-web", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "tokio", ] @@ -4903,15 +4748,15 @@ version = "2.0.0" dependencies = [ "actix-identity", "actix-web", - "argonautica", "chrono", "derive_more", "diesel", "dotenv", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "lazy_static", "r2d2", + "rust-argon2", "serde 1.0.117", "serde_json", "sparkpost", @@ -5041,8 +4886,8 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "serde 1.0.117", "serde_derive", "syn", @@ -5055,8 +4900,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" dependencies = [ "base-x", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "serde 1.0.117", "serde_derive", "serde_json", @@ -5091,8 +4936,8 @@ checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" dependencies = [ "phf_generator", "phf_shared", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", ] [[package]] @@ -5135,9 +4980,9 @@ version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "unicode-xid 0.2.1", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] @@ -5148,7 +4993,7 @@ checksum = "c11664eb1aded8a1be30656bedb3c2ee3d6b594842c90ec635cf7b855a5d8478" dependencies = [ "proc-macro2-impersonated", "quote-impersonated", - "unicode-xid 0.2.1", + "unicode-xid", ] [[package]] @@ -5157,10 +5002,10 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", - "unicode-xid 0.2.1", + "unicode-xid", ] [[package]] @@ -5339,8 +5184,8 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -5405,8 +5250,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "standback", "syn", ] @@ -5466,8 +5311,8 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -5496,7 +5341,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b6945ad3b3b9f035740a75b59b8fa0708514485967649d931255cd5acd4e614" dependencies = [ - "quote 1.0.7", + "quote", "syn", "tokio-postgres", ] @@ -5511,7 +5356,7 @@ dependencies = [ "byteorder", "bytes 0.5.6", "fallible-iterator", - "futures 0.3.8", + "futures", "log", "parking_lot", "percent-encoding", @@ -5607,8 +5452,8 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -5640,7 +5485,7 @@ dependencies = [ "async-trait", "backtrace", "enum-as-inner", - "futures 0.3.8", + "futures", "idna", "lazy_static", "log", @@ -5659,7 +5504,7 @@ checksum = "6759e8efc40465547b0dfce9500d733c65f969a4cbbfbe3ccf68daaa46ef179e" dependencies = [ "backtrace", "cfg-if 0.1.10", - "futures 0.3.8", + "futures", "ipconfig", "lazy_static", "log", @@ -5726,7 +5571,7 @@ dependencies = [ "actix", "actix-rt", "bytes 0.5.6", - "futures 0.3.8", + "futures", "futures-util", "tokio", "tokio-util", @@ -5827,12 +5672,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.1" @@ -5933,8 +5772,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae" dependencies = [ "nom 4.2.3", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -5945,8 +5784,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c860ad1273f4eee7006cee05db20c9e60e5d24cba024a32e1094aa8e574f3668" dependencies = [ "nom 4.2.3", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", ] @@ -6013,8 +5852,8 @@ checksum = "0d577dfb8ca9440a5c0b053d5a19b68f5c92ef57064bac87c8205c3f6072c20f" dependencies = [ "if_chain", "lazy_static", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "regex", "syn", "validator", @@ -6116,8 +5955,8 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "wasm-bindgen-shared", ] @@ -6140,7 +5979,7 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ - "quote 1.0.7", + "quote", "wasm-bindgen-macro-support", ] @@ -6150,8 +5989,8 @@ version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -6183,8 +6022,8 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", ] [[package]] @@ -6228,7 +6067,7 @@ dependencies = [ "awc", "bytes 0.5.6", "env_logger 0.7.1", - "futures 0.3.8", + "futures", ] [[package]] @@ -6252,7 +6091,7 @@ dependencies = [ "actix-web", "actix-web-actors", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "log", "rand", ] @@ -6268,7 +6107,7 @@ dependencies = [ "byteorder", "bytes 0.5.6", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "rand", "serde 1.0.117", "serde_json", @@ -6303,7 +6142,7 @@ dependencies = [ "byteorder", "bytes 0.5.6", "env_logger 0.7.1", - "futures 0.3.8", + "futures", "rand", "serde 1.0.117", "serde_json", @@ -6320,16 +6159,6 @@ dependencies = [ "cc", ] -[[package]] -name = "which" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" -dependencies = [ - "failure", - "libc", -] - [[package]] name = "widestring" version = "0.4.3" @@ -6524,8 +6353,8 @@ dependencies = [ "log", "mac", "markup5ever", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "syn", "yarte_parser", ] @@ -6541,7 +6370,7 @@ dependencies = [ "proc-macro2-impersonated", "quote-impersonated", "syn-impersonated", - "unicode-xid 0.2.1", + "unicode-xid", "yarte_helpers", ] diff --git a/simple-auth-server/Cargo.toml b/simple-auth-server/Cargo.toml index 15f5694..03db9a9 100644 --- a/simple-auth-server/Cargo.toml +++ b/simple-auth-server/Cargo.toml @@ -9,8 +9,6 @@ workspace = ".." actix-web = "3" actix-identity = "0.3" -# FIXME: Specify the commit hash to use bindgen v0.50. -argonautica = { git = "https://github.com/bcmyers/argonautica", rev = "67fc8d8d7d67696cd8ca7a59b92531f06b089212" } chrono = { version = "0.4.6", features = ["serde"] } derive_more = "0.99.0" diesel = { version = "1.4.5", features = ["postgres", "uuidv07", "r2d2", "chrono"] } @@ -18,6 +16,7 @@ dotenv = "0.15" env_logger = "0.7" futures = "0.3.1" r2d2 = "0.8" +rust-argon2 = "0.8" lazy_static = "1.4.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/simple-auth-server/README.md b/simple-auth-server/README.md index 2ef4671..eba499f 100644 --- a/simple-auth-server/README.md +++ b/simple-auth-server/README.md @@ -9,7 +9,7 @@ ##### Crates Used - [actix-web](https://crates.io/crates/actix-web) // Actix web is a simple, pragmatic and extremely fast web framework for Rust. -- [argonautica](https://docs.rs/argonautica) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm. +- [rust-argon2](https://crates.io/crates/rust-argon2) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm. - [chrono](https://crates.io/crates/chrono) // Date and time library for Rust. - [diesel](https://crates.io/crates/diesel) // A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL. - [dotenv](https://crates.io/crates/dotenv) // A dotenv implementation for Rust. diff --git a/simple-auth-server/src/utils.rs b/simple-auth-server/src/utils.rs index ce2e66a..c672718 100644 --- a/simple-auth-server/src/utils.rs +++ b/simple-auth-server/src/utils.rs @@ -1,28 +1,26 @@ use crate::errors::ServiceError; -use argonautica::{Hasher, Verifier}; +use argon2::{self, Config}; lazy_static::lazy_static! { -pub static ref SECRET_KEY: String = std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8)); + pub static ref SECRET_KEY: String = std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8)); } +const SALT: &'static [u8] = b"supersecuresalt"; + // WARNING THIS IS ONLY FOR DEMO PLEASE DO MORE RESEARCH FOR PRODUCTION USE pub fn hash_password(password: &str) -> Result { - Hasher::default() - .with_password(password) - .with_secret_key(SECRET_KEY.as_str()) - .hash() - .map_err(|err| { - dbg!(err); - ServiceError::InternalServerError - }) + let config = Config { + secret: SECRET_KEY.as_bytes(), + ..Default::default() + }; + argon2::hash_encoded(password.as_bytes(), &SALT, &config).map_err(|err| { + dbg!(err); + ServiceError::InternalServerError + }) } pub fn verify(hash: &str, password: &str) -> Result { - Verifier::default() - .with_hash(hash) - .with_password(password) - .with_secret_key(SECRET_KEY.as_str()) - .verify() + argon2::verify_encoded_ext(hash, password.as_bytes(), SECRET_KEY.as_bytes(), &[]) .map_err(|err| { dbg!(err); ServiceError::Unauthorized