1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00

update argon2 dep

This commit is contained in:
Rob Ede 2023-10-29 01:08:45 +01:00
parent 1a44c313e4
commit 95926dc0f5
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 5 additions and 7 deletions

5
Cargo.lock generated
View File

@ -6291,14 +6291,13 @@ dependencies = [
[[package]]
name = "rust-argon2"
version = "1.0.1"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5885493fdf0be6cdff808d1533ce878d21cfa49c7086fa00c66355cd9141bfc"
checksum = "1e71971821b3ae0e769e4a4328dbcb517607b434db7697e9aba17203ec14e46a"
dependencies = [
"base64 0.21.5",
"blake2b_simd",
"constant_time_eq",
"crossbeam-utils 0.8.16",
]
[[package]]

View File

@ -16,7 +16,7 @@ env_logger.workspace = true
log = "0.4"
once_cell = "1"
r2d2 = "0.8"
rust-argon2 = "1"
rust-argon2 = "2"
serde_json.workspace = true
serde.workspace = true
sparkpost = "0.5"

View File

@ -1,4 +1,3 @@
use argon2::{self, Config};
use once_cell::sync::Lazy;
use crate::errors::ServiceError;
@ -10,9 +9,9 @@ const SALT: &[u8] = b"supersecuresalt";
// PLEASE NOTE THIS IS ONLY FOR DEMO PLEASE DO MORE RESEARCH FOR PRODUCTION USE
pub fn hash_password(password: &str) -> Result<String, ServiceError> {
let config = Config {
let config = argon2::Config {
secret: SECRET_KEY.as_bytes(),
..Default::default()
..argon2::Config::rfc9106_low_mem()
};
argon2::hash_encoded(password.as_bytes(), SALT, &config).map_err(|err| {
dbg!(err);