1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

update argon2 dep

This commit is contained in:
Rob Ede
2023-10-29 01:08:45 +01:00
parent 1a44c313e4
commit 95926dc0f5
3 changed files with 5 additions and 7 deletions

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);