1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

Use rust-argon2 instead of less-maintained argonautica (#389)

This commit is contained in:
Yuki Okushi 2020-12-02 12:29:03 +09:00 committed by GitHub
parent 876da8cf70
commit 5c8749c2a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 132 additions and 306 deletions

405
Cargo.lock generated
View File

@ -231,7 +231,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2"
dependencies = [ dependencies = [
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -424,7 +424,7 @@ dependencies = [
"diesel", "diesel",
"dotenv", "dotenv",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"log", "log",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -514,8 +514,8 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb" checksum = "ad26f77093333e0e7c6ffe54ebe3582d908a104e448723eec6d43d08b07143fb"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -526,7 +526,7 @@ dependencies = [
"actix-cors 0.5.3", "actix-cors 0.5.3",
"actix-web", "actix-web",
"env_logger 0.8.2", "env_logger 0.8.2",
"futures 0.3.8", "futures",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
] ]
@ -537,8 +537,8 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c" checksum = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -550,7 +550,7 @@ dependencies = [
"actix-redis", "actix-redis",
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"redis-async", "redis-async",
"serde 1.0.117", "serde 1.0.117",
] ]
@ -681,28 +681,6 @@ version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7" 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]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.6" version = "0.3.6"
@ -743,8 +721,8 @@ checksum = "e1012c270085fa35ece6a48a569544fde85b6d9ee41074c7b706cc912a03f939"
dependencies = [ dependencies = [
"askama_shared", "askama_shared",
"nom 5.1.2", "nom 5.1.2",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -881,8 +859,8 @@ dependencies = [
"async-graphql-parser", "async-graphql-parser",
"darling", "darling",
"proc-macro-crate", "proc-macro-crate",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"thiserror", "thiserror",
] ]
@ -982,8 +960,8 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -999,8 +977,8 @@ version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1021,7 +999,7 @@ dependencies = [
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"failure", "failure",
"futures 0.3.8", "futures",
"num_cpus", "num_cpus",
"r2d2", "r2d2",
"r2d2_sqlite", "r2d2_sqlite",
@ -1039,7 +1017,7 @@ dependencies = [
"actix-web", "actix-web",
"bytes 0.5.6", "bytes 0.5.6",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
"time 0.1.44", "time 0.1.44",
@ -1115,7 +1093,7 @@ version = "2.0.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
"validator", "validator",
@ -1160,15 +1138,6 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"
[[package]]
name = "base64"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.11.0" version = "0.11.0"
@ -1220,29 +1189,6 @@ dependencies = [
"serde 1.0.117", "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]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
@ -1455,18 +1401,6 @@ name = "cc"
version = "1.0.65" version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" 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]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -1513,17 +1447,6 @@ dependencies = [
"generic-array 0.14.4", "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]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "2.33.3"
@ -1830,8 +1753,8 @@ checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
dependencies = [ dependencies = [
"fnv", "fnv",
"ident_case", "ident_case",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"strsim 0.9.3", "strsim 0.9.3",
"syn", "syn",
] ]
@ -1843,7 +1766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1870,7 +1793,7 @@ dependencies = [
"async-trait", "async-trait",
"config", "config",
"deadpool", "deadpool",
"futures 0.3.8", "futures",
"log", "log",
"serde 1.0.117", "serde 1.0.117",
"tokio", "tokio",
@ -1885,8 +1808,8 @@ checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0"
dependencies = [ dependencies = [
"darling", "darling",
"derive_builder_core", "derive_builder_core",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1897,8 +1820,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1908,8 +1831,8 @@ version = "0.99.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1919,8 +1842,8 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64196eb9f551916167225134f1e8a90f0b5774331d3c900d6328fd94bafe3544" checksum = "64196eb9f551916167225134f1e8a90f0b5774331d3c900d6328fd94bafe3544"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -1955,7 +1878,7 @@ dependencies = [
"dotenv", "dotenv",
"env_logger 0.7.1", "env_logger 0.7.1",
"failure", "failure",
"futures 0.3.8", "futures",
"r2d2", "r2d2",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -1968,8 +1891,8 @@ version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -2150,24 +2073,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "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]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.7.1" version = "0.7.1"
@ -2236,8 +2146,8 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"synstructure", "synstructure",
] ]
@ -2348,12 +2258,6 @@ dependencies = [
"new_debug_unreachable", "new_debug_unreachable",
] ]
[[package]]
name = "futures"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.8" version = "0.3.8"
@ -2385,16 +2289,6 @@ version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" 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]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.8" version = "0.3.8"
@ -2434,8 +2328,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -2528,12 +2422,6 @@ version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce"
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "globset" name = "globset"
version = "0.4.6" version = "0.4.6"
@ -2868,7 +2756,7 @@ checksum = "1563b111bd1337885303dc431bc52f23ac0f48ca9d2ac73da423749d547ac6c8"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"derive_utils", "derive_utils",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -2920,15 +2808,6 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "jobserver"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.45" version = "0.3.45"
@ -2952,7 +2831,7 @@ dependencies = [
"actix-service", "actix-service",
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"json", "json",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -2983,7 +2862,7 @@ dependencies = [
"actix-web", "actix-web",
"bytes 0.5.6", "bytes 0.5.6",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"log", "log",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -3041,8 +2920,8 @@ version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40af234d8e971a9d7dda93ffbcc8a44a93f17e69e3067f72ce7a6894c41d51b" checksum = "d40af234d8e971a9d7dda93ffbcc8a44a93f17e69e3067f72ce7a6894c41d51b"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -3126,16 +3005,6 @@ version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" 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]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.17.3" version = "0.17.3"
@ -3297,7 +3166,7 @@ dependencies = [
"actix-service", "actix-service",
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"pin-project 0.4.27", "pin-project 0.4.27",
] ]
@ -3400,7 +3269,7 @@ dependencies = [
"bytes 0.5.6", "bytes 0.5.6",
"derive_more", "derive_more",
"encoding_rs", "encoding_rs",
"futures 0.3.8", "futures",
"http", "http",
"httparse", "httparse",
"lazy_static", "lazy_static",
@ -3417,7 +3286,7 @@ dependencies = [
"actix-multipart", "actix-multipart",
"actix-web", "actix-web",
"async-std", "async-std",
"futures 0.3.8", "futures",
"sanitize-filename", "sanitize-filename",
] ]
@ -3427,7 +3296,7 @@ version = "0.3.0"
dependencies = [ dependencies = [
"actix-multipart", "actix-multipart",
"actix-web", "actix-web",
"futures 0.3.8", "futures",
"sanitize-filename", "sanitize-filename",
] ]
@ -3439,7 +3308,7 @@ dependencies = [
"actix-web", "actix-web",
"bytes 0.5.6", "bytes 0.5.6",
"dotenv", "dotenv",
"futures 0.3.8", "futures",
"rusoto_core", "rusoto_core",
"rusoto_s3", "rusoto_s3",
"sanitize-filename", "sanitize-filename",
@ -3772,12 +3641,6 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.1.0" version = "2.1.0"
@ -3811,8 +3674,8 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [ dependencies = [
"pest", "pest",
"pest_meta", "pest_meta",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -3889,8 +3752,8 @@ version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -3900,8 +3763,8 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -4058,22 +3921,13 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" 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]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.24" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [ dependencies = [
"unicode-xid 0.2.1", "unicode-xid",
] ]
[[package]] [[package]]
@ -4082,7 +3936,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32df793782c132f437089d84b487d617a0baac886fa8519751dca07db9266e0" checksum = "d32df793782c132f437089d84b487d617a0baac886fa8519751dca07db9266e0"
dependencies = [ dependencies = [
"unicode-xid 0.2.1", "unicode-xid",
] ]
[[package]] [[package]]
@ -4103,8 +3957,8 @@ checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -4133,22 +3987,13 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" 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]] [[package]]
name = "quote" name = "quote"
version = "1.0.7" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
] ]
[[package]] [[package]]
@ -4448,7 +4293,7 @@ dependencies = [
"async-trait", "async-trait",
"base64 0.12.3", "base64 0.12.3",
"bytes 0.5.6", "bytes 0.5.6",
"futures 0.3.8", "futures",
"hmac 0.7.1", "hmac 0.7.1",
"http", "http",
"hyper", "hyper",
@ -4477,7 +4322,7 @@ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
"dirs 2.0.2", "dirs 2.0.2",
"futures 0.3.8", "futures",
"hyper", "hyper",
"pin-project 0.4.27", "pin-project 0.4.27",
"regex", "regex",
@ -4496,7 +4341,7 @@ checksum = "2b6bc3221ae5a2c036d5757eee68a2ffb6b7f87b8a83adbf4271c8133fdee01c"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes 0.5.6", "bytes 0.5.6",
"futures 0.3.8", "futures",
"rusoto_core", "rusoto_core",
"xml-rs", "xml-rs",
] ]
@ -4509,7 +4354,7 @@ checksum = "62940a2bd479900a1bf8935b8f254d3e19368ac3ac4570eb4bd48eb46551a1b7"
dependencies = [ dependencies = [
"base64 0.12.3", "base64 0.12.3",
"bytes 0.5.6", "bytes 0.5.6",
"futures 0.3.8", "futures",
"hex", "hex",
"hmac 0.7.1", "hmac 0.7.1",
"http", "http",
@ -4762,8 +4607,8 @@ version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -4806,7 +4651,7 @@ version = "1.0.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"tokio", "tokio",
] ]
@ -4884,7 +4729,7 @@ version = "2.0.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"tokio", "tokio",
] ]
@ -4903,15 +4748,15 @@ version = "2.0.0"
dependencies = [ dependencies = [
"actix-identity", "actix-identity",
"actix-web", "actix-web",
"argonautica",
"chrono", "chrono",
"derive_more", "derive_more",
"diesel", "diesel",
"dotenv", "dotenv",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"lazy_static", "lazy_static",
"r2d2", "r2d2",
"rust-argon2",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
"sparkpost", "sparkpost",
@ -5041,8 +4886,8 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"serde 1.0.117", "serde 1.0.117",
"serde_derive", "serde_derive",
"syn", "syn",
@ -5055,8 +4900,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [ dependencies = [
"base-x", "base-x",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"serde 1.0.117", "serde 1.0.117",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -5091,8 +4936,8 @@ checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
dependencies = [ dependencies = [
"phf_generator", "phf_generator",
"phf_shared", "phf_shared",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
] ]
[[package]] [[package]]
@ -5135,9 +4980,9 @@ version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68" checksum = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"unicode-xid 0.2.1", "unicode-xid",
] ]
[[package]] [[package]]
@ -5148,7 +4993,7 @@ checksum = "c11664eb1aded8a1be30656bedb3c2ee3d6b594842c90ec635cf7b855a5d8478"
dependencies = [ dependencies = [
"proc-macro2-impersonated", "proc-macro2-impersonated",
"quote-impersonated", "quote-impersonated",
"unicode-xid 0.2.1", "unicode-xid",
] ]
[[package]] [[package]]
@ -5157,10 +5002,10 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"unicode-xid 0.2.1", "unicode-xid",
] ]
[[package]] [[package]]
@ -5339,8 +5184,8 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -5405,8 +5250,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"standback", "standback",
"syn", "syn",
] ]
@ -5466,8 +5311,8 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -5496,7 +5341,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b6945ad3b3b9f035740a75b59b8fa0708514485967649d931255cd5acd4e614" checksum = "3b6945ad3b3b9f035740a75b59b8fa0708514485967649d931255cd5acd4e614"
dependencies = [ dependencies = [
"quote 1.0.7", "quote",
"syn", "syn",
"tokio-postgres", "tokio-postgres",
] ]
@ -5511,7 +5356,7 @@ dependencies = [
"byteorder", "byteorder",
"bytes 0.5.6", "bytes 0.5.6",
"fallible-iterator", "fallible-iterator",
"futures 0.3.8", "futures",
"log", "log",
"parking_lot", "parking_lot",
"percent-encoding", "percent-encoding",
@ -5607,8 +5452,8 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -5640,7 +5485,7 @@ dependencies = [
"async-trait", "async-trait",
"backtrace", "backtrace",
"enum-as-inner", "enum-as-inner",
"futures 0.3.8", "futures",
"idna", "idna",
"lazy_static", "lazy_static",
"log", "log",
@ -5659,7 +5504,7 @@ checksum = "6759e8efc40465547b0dfce9500d733c65f969a4cbbfbe3ccf68daaa46ef179e"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"cfg-if 0.1.10", "cfg-if 0.1.10",
"futures 0.3.8", "futures",
"ipconfig", "ipconfig",
"lazy_static", "lazy_static",
"log", "log",
@ -5726,7 +5571,7 @@ dependencies = [
"actix", "actix",
"actix-rt", "actix-rt",
"bytes 0.5.6", "bytes 0.5.6",
"futures 0.3.8", "futures",
"futures-util", "futures-util",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -5827,12 +5672,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.1" version = "0.2.1"
@ -5933,8 +5772,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae" checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae"
dependencies = [ dependencies = [
"nom 4.2.3", "nom 4.2.3",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -5945,8 +5784,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c860ad1273f4eee7006cee05db20c9e60e5d24cba024a32e1094aa8e574f3668" checksum = "c860ad1273f4eee7006cee05db20c9e60e5d24cba024a32e1094aa8e574f3668"
dependencies = [ dependencies = [
"nom 4.2.3", "nom 4.2.3",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
] ]
@ -6013,8 +5852,8 @@ checksum = "0d577dfb8ca9440a5c0b053d5a19b68f5c92ef57064bac87c8205c3f6072c20f"
dependencies = [ dependencies = [
"if_chain", "if_chain",
"lazy_static", "lazy_static",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"regex", "regex",
"syn", "syn",
"validator", "validator",
@ -6116,8 +5955,8 @@ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
"log", "log",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -6140,7 +5979,7 @@ version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
dependencies = [ dependencies = [
"quote 1.0.7", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
] ]
@ -6150,8 +5989,8 @@ version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
@ -6183,8 +6022,8 @@ version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585" checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585"
dependencies = [ dependencies = [
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
] ]
[[package]] [[package]]
@ -6228,7 +6067,7 @@ dependencies = [
"awc", "awc",
"bytes 0.5.6", "bytes 0.5.6",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
] ]
[[package]] [[package]]
@ -6252,7 +6091,7 @@ dependencies = [
"actix-web", "actix-web",
"actix-web-actors", "actix-web-actors",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"log", "log",
"rand", "rand",
] ]
@ -6268,7 +6107,7 @@ dependencies = [
"byteorder", "byteorder",
"bytes 0.5.6", "bytes 0.5.6",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"rand", "rand",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -6303,7 +6142,7 @@ dependencies = [
"byteorder", "byteorder",
"bytes 0.5.6", "bytes 0.5.6",
"env_logger 0.7.1", "env_logger 0.7.1",
"futures 0.3.8", "futures",
"rand", "rand",
"serde 1.0.117", "serde 1.0.117",
"serde_json", "serde_json",
@ -6320,16 +6159,6 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "which"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164"
dependencies = [
"failure",
"libc",
]
[[package]] [[package]]
name = "widestring" name = "widestring"
version = "0.4.3" version = "0.4.3"
@ -6524,8 +6353,8 @@ dependencies = [
"log", "log",
"mac", "mac",
"markup5ever", "markup5ever",
"proc-macro2 1.0.24", "proc-macro2",
"quote 1.0.7", "quote",
"syn", "syn",
"yarte_parser", "yarte_parser",
] ]
@ -6541,7 +6370,7 @@ dependencies = [
"proc-macro2-impersonated", "proc-macro2-impersonated",
"quote-impersonated", "quote-impersonated",
"syn-impersonated", "syn-impersonated",
"unicode-xid 0.2.1", "unicode-xid",
"yarte_helpers", "yarte_helpers",
] ]

View File

@ -9,8 +9,6 @@ workspace = ".."
actix-web = "3" actix-web = "3"
actix-identity = "0.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"] } chrono = { version = "0.4.6", features = ["serde"] }
derive_more = "0.99.0" derive_more = "0.99.0"
diesel = { version = "1.4.5", features = ["postgres", "uuidv07", "r2d2", "chrono"] } diesel = { version = "1.4.5", features = ["postgres", "uuidv07", "r2d2", "chrono"] }
@ -18,6 +16,7 @@ dotenv = "0.15"
env_logger = "0.7" env_logger = "0.7"
futures = "0.3.1" futures = "0.3.1"
r2d2 = "0.8" r2d2 = "0.8"
rust-argon2 = "0.8"
lazy_static = "1.4.0" lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"

View File

@ -9,7 +9,7 @@
##### Crates Used ##### Crates Used
- [actix-web](https://crates.io/crates/actix-web) // Actix web is a simple, pragmatic and extremely fast web framework for Rust. - [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. - [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. - [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. - [dotenv](https://crates.io/crates/dotenv) // A dotenv implementation for Rust.

View File

@ -1,28 +1,26 @@
use crate::errors::ServiceError; use crate::errors::ServiceError;
use argonautica::{Hasher, Verifier}; use argon2::{self, Config};
lazy_static::lazy_static! { 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 // WARNING THIS IS ONLY FOR DEMO PLEASE DO MORE RESEARCH FOR PRODUCTION USE
pub fn hash_password(password: &str) -> Result<String, ServiceError> { pub fn hash_password(password: &str) -> Result<String, ServiceError> {
Hasher::default() let config = Config {
.with_password(password) secret: SECRET_KEY.as_bytes(),
.with_secret_key(SECRET_KEY.as_str()) ..Default::default()
.hash() };
.map_err(|err| { argon2::hash_encoded(password.as_bytes(), &SALT, &config).map_err(|err| {
dbg!(err); dbg!(err);
ServiceError::InternalServerError ServiceError::InternalServerError
}) })
} }
pub fn verify(hash: &str, password: &str) -> Result<bool, ServiceError> { pub fn verify(hash: &str, password: &str) -> Result<bool, ServiceError> {
Verifier::default() argon2::verify_encoded_ext(hash, password.as_bytes(), SECRET_KEY.as_bytes(), &[])
.with_hash(hash)
.with_password(password)
.with_secret_key(SECRET_KEY.as_str())
.verify()
.map_err(|err| { .map_err(|err| {
dbg!(err); dbg!(err);
ServiceError::Unauthorized ServiceError::Unauthorized