From 0b56faebaec9215037cddf504a8f3579a8343805 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Tue, 23 Jul 2024 22:22:42 +0300
Subject: [PATCH] fix: Use `K256Secret` directly
Signed-off-by: Awiteb
---
crates/oxidetalis/src/websocket/mod.rs | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/crates/oxidetalis/src/websocket/mod.rs b/crates/oxidetalis/src/websocket/mod.rs
index dcbdd56..5986203 100644
--- a/crates/oxidetalis/src/websocket/mod.rs
+++ b/crates/oxidetalis/src/websocket/mod.rs
@@ -23,7 +23,7 @@ use chrono::Utc;
use errors::{WsError, WsResult};
use futures::{channel::mpsc, FutureExt, StreamExt, TryStreamExt};
use once_cell::sync::Lazy;
-use oxidetalis_core::{cipher::K256Secret, types::PublicKey};
+use oxidetalis_core::types::PublicKey;
use oxidetalis_entities::prelude::*;
use salvo::{
handler,
@@ -102,9 +102,7 @@ pub async fn user_connected(
let db_conn = depot.db_conn();
let public_key =
utils::extract_public_key(req).expect("The public key was checked in the middleware");
- // FIXME: The config should hold `K256Secret` not `PrivateKey`
- let shared_secret =
- K256Secret::from_privkey(&depot.config().server.private_key).shared_secret(&public_key);
+ let shared_secret = depot.config().server.private_key.shared_secret(&public_key);
WebSocketUpgrade::new()
.upgrade(req, res, move |ws| {