feat(server): use better salt

This commit is contained in:
Anna 2023-10-08 20:36:13 -04:00
parent 5ec42b4432
commit a4bf201ffa
Signed by: anna
GPG Key ID: D0943384CD9F87D1
1 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@ use axum::http::Method;
use axum::response::{IntoResponse, Response};
use axum::routing::{get, post};
use bytes::Bytes;
use rand::distributions::{Alphanumeric, DistString};
use rand::Rng;
use serde::{Deserialize, Serialize};
use serde::de::DeserializeOwned;
use siphasher::sip::SipHasher;
@ -64,7 +64,11 @@ async fn main() -> Result<()> {
let state = Arc::new(AppState {
pool,
salt: Alphanumeric.sample_string(&mut rand::thread_rng(), 8),
salt: data_encoding::BASE64_NOPAD.encode(&{
let mut bytes = [0; 16];
rand::thread_rng().fill(&mut bytes);
bytes
}),
hasher: SipHasher::new(),
});