Skip to content

Commit

Permalink
Adds proper key generation and exchange
Browse files Browse the repository at this point in the history
This change adds proper key generation and exchange to Session::new()
and removes the garbage key.

Signed-off-by: Dhanuka Warusadura <dhanuka@gnome.org>
  • Loading branch information
warusadura committed Feb 29, 2024
1 parent fd49a32 commit 1ea5e4e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/src/daemon/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ impl Session {
manager: Arc<Mutex<ServiceManager>>,
sessions_counter: i32,
) -> (Self, Option<Key>) {
// 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))

Check failure on line 43 in server/src/daemon/session.rs

View workflow job for this annotation

GitHub Actions / Clippy

useless conversion to the same type: `oo7::Key`
};

let instance = Self {
client_public_key: Arc::new(client_public_key),
path: OwnedObjectPath::try_from(format!(
Expand All @@ -47,7 +53,7 @@ impl Session {
manager,
};

(instance, Some(Key::new(service_key)))
(instance, service_key)
}

pub fn path(&self) -> ObjectPath<'_> {
Expand Down

0 comments on commit 1ea5e4e

Please sign in to comment.