diff --git a/server/src/daemon/session.rs b/server/src/daemon/session.rs index b1621b804..0ba8242ef 100644 --- a/server/src/daemon/session.rs +++ b/server/src/daemon/session.rs @@ -35,8 +35,14 @@ impl Session { manager: Arc>, sessions_counter: i32, ) -> (Self, Option) { - // make use of the keys - let service_key = vec![0]; + let service_key = if client_public_key.is_none() { + Some(Key::new(vec![0])) + } else { + let private_key = Key::generate_private_key(); + let public_key = Key::generate_public_key(&private_key); + Some(Key::from(public_key)) + }; + let instance = Self { client_public_key: Arc::new(client_public_key), path: OwnedObjectPath::try_from(format!( @@ -47,7 +53,7 @@ impl Session { manager, }; - (instance, Some(Key::new(service_key))) + (instance, service_key) } pub fn path(&self) -> ObjectPath<'_> {