mirror of
https://github.com/actix/examples
synced 2024-11-23 22:41:07 +01:00
update argon2 dep
This commit is contained in:
parent
1a44c313e4
commit
95926dc0f5
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -6291,14 +6291,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-argon2"
|
name = "rust-argon2"
|
||||||
version = "1.0.1"
|
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 = "a5885493fdf0be6cdff808d1533ce878d21cfa49c7086fa00c66355cd9141bfc"
|
checksum = "1e71971821b3ae0e769e4a4328dbcb517607b434db7697e9aba17203ec14e46a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
"blake2b_simd",
|
"blake2b_simd",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
"crossbeam-utils 0.8.16",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -16,7 +16,7 @@ env_logger.workspace = true
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
r2d2 = "0.8"
|
r2d2 = "0.8"
|
||||||
rust-argon2 = "1"
|
rust-argon2 = "2"
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
sparkpost = "0.5"
|
sparkpost = "0.5"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use argon2::{self, Config};
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use crate::errors::ServiceError;
|
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
|
// PLEASE NOTE 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> {
|
||||||
let config = Config {
|
let config = argon2::Config {
|
||||||
secret: SECRET_KEY.as_bytes(),
|
secret: SECRET_KEY.as_bytes(),
|
||||||
..Default::default()
|
..argon2::Config::rfc9106_low_mem()
|
||||||
};
|
};
|
||||||
argon2::hash_encoded(password.as_bytes(), SALT, &config).map_err(|err| {
|
argon2::hash_encoded(password.as_bytes(), SALT, &config).map_err(|err| {
|
||||||
dbg!(err);
|
dbg!(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user