slight ui/ux fixes and updates to auth protocol

This commit is contained in:
DecDuck
2024-10-12 17:44:23 +11:00
parent e828bca2a5
commit 8a2d23df26
4 changed files with 26 additions and 8 deletions

View File

@ -1,8 +1,9 @@
use core::time;
use std::{
borrow::{Borrow, BorrowMut},
env,
fmt::format,
sync::Mutex,
sync::Mutex, time::{SystemTime, UNIX_EPOCH},
};
use log::{info, warn};
@ -69,7 +70,12 @@ pub fn generate_authorization_header() -> String {
db.auth.clone().unwrap()
};
let nonce = Uuid::new_v4().to_string();
let start = SystemTime::now();
let timestamp = start
.duration_since(UNIX_EPOCH)
.expect("Time went backwards");
let nonce = timestamp.as_millis().to_string();
let signature = sign_nonce(certs.private, nonce.clone()).unwrap();
return format!("Nonce {} {} {}", certs.clientId, nonce, signature);