refactor: Change config private key type to K256Secret
#30
1 changed files with 2 additions and 4 deletions
|
@ -23,7 +23,7 @@ use chrono::Utc;
|
||||||
use errors::{WsError, WsResult};
|
use errors::{WsError, WsResult};
|
||||||
use futures::{channel::mpsc, FutureExt, StreamExt, TryStreamExt};
|
use futures::{channel::mpsc, FutureExt, StreamExt, TryStreamExt};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use oxidetalis_core::{cipher::K256Secret, types::PublicKey};
|
use oxidetalis_core::types::PublicKey;
|
||||||
use oxidetalis_entities::prelude::*;
|
use oxidetalis_entities::prelude::*;
|
||||||
use salvo::{
|
use salvo::{
|
||||||
handler,
|
handler,
|
||||||
|
@ -102,9 +102,7 @@ pub async fn user_connected(
|
||||||
let db_conn = depot.db_conn();
|
let db_conn = depot.db_conn();
|
||||||
let public_key =
|
let public_key =
|
||||||
utils::extract_public_key(req).expect("The public key was checked in the middleware");
|
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 = depot.config().server.private_key.shared_secret(&public_key);
|
||||||
let shared_secret =
|
|
||||||
K256Secret::from_privkey(&depot.config().server.private_key).shared_secret(&public_key);
|
|
||||||
|
|
||||||
WebSocketUpgrade::new()
|
WebSocketUpgrade::new()
|
||||||
.upgrade(req, res, move |ws| {
|
.upgrade(req, res, move |ws| {
|
||||||
|
|
Loading…
Reference in a new issue