From 29c48afafb4a6a0a0636774f9b56423881fb1703 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 29 May 2024 23:44:14 +0200 Subject: implement cookie base auth. --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 7c74f70..5a88ad1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ pub mod helper; #[cfg(feature = "mond")] pub mod reporting; +use aes_gcm_siv::{aead::generic_array::GenericArray, Aes256GcmSiv, KeyInit}; use anyhow::{anyhow, Context, Result}; use config::{setup_file_watch, Config, NODE_KINDS}; use error::ServiceError; @@ -46,6 +47,7 @@ use tokio::{ use tokio_rustls::TlsAcceptor; pub struct State { + pub crypto_key: Aes256GcmSiv, pub config: RwLock>, pub access_logs: RwLock>>, pub l_incoming: Semaphore, @@ -81,6 +83,7 @@ async fn main() -> anyhow::Result<()> { } }; let state = Arc::new(State { + crypto_key: aes_gcm_siv::Aes256GcmSiv::new(GenericArray::from_slice(&config.private_key)), l_incoming: Semaphore::new(config.limits.max_incoming_connections), l_outgoing: Semaphore::new(config.limits.max_outgoing_connections), #[cfg(feature = "mond")] -- cgit v1.2.3-70-g09d2