Sending pubkey

This commit is contained in:
2026-08-28 12:57:07 +02:00
parent 67215c4af0
commit 7a21c71817
2 changed files with 16 additions and 1 deletions
+11
View File
@@ -4,6 +4,7 @@ use std::{
}; };
use ed25519_dalek::{Signer, VerifyingKey}; use ed25519_dalek::{Signer, VerifyingKey};
use futures_util::SinkExt;
use crate::{server::Server, ws::EnclaveWebSocket}; use crate::{server::Server, ws::EnclaveWebSocket};
@@ -15,6 +16,16 @@ impl UserConnections {
server: &Arc<Server>, server: &Arc<Server>,
socket: Arc<EnclaveWebSocket>, socket: Arc<EnclaveWebSocket>,
) -> anyhow::Result<(Arc<EnclaveWebSocket>, VerifyingKey, ClientMeta)> { ) -> anyhow::Result<(Arc<EnclaveWebSocket>, VerifyingKey, ClientMeta)> {
{
socket
.tx()
.await
.send(axum::extract::ws::Message::Binary(
server.key.verifying_key().to_bytes().to_vec().into(),
))
.await?;
}
let Some(ServerMethod::Initialize { let Some(ServerMethod::Initialize {
public_key: public_key_string, public_key: public_key_string,
signature, signature,
+5 -1
View File
@@ -5,7 +5,7 @@ use futures_util::{
SinkExt, StreamExt, SinkExt, StreamExt,
stream::{SplitSink, SplitStream}, stream::{SplitSink, SplitStream},
}; };
use tokio::sync::Mutex; use tokio::sync::{Mutex, MutexGuard};
use crate::protocol::{ClientMethod, ServerMethod}; use crate::protocol::{ClientMethod, ServerMethod};
@@ -62,4 +62,8 @@ impl EnclaveWebSocket {
Ok(()) Ok(())
} }
pub async fn tx(&self) -> MutexGuard<'_, SplitSink<WebSocket, Message>> {
self.tx.lock().await
}
} }