refactor(server): migrated auth to ml-dsa

This commit is contained in:
hdbg
2026-04-07 11:43:21 +02:00
parent 1497884ce6
commit 0d424f3afc
25 changed files with 457 additions and 414 deletions

View File

@@ -22,6 +22,7 @@ use tracing::warn;
use crate::{
actors::client::{self, ClientConnection, auth},
crypto::authn,
grpc::request_tracker::RequestTracker,
};
@@ -45,7 +46,7 @@ impl<'a> AuthTransportAdapter<'a> {
match response {
auth::Outbound::AuthChallenge { pubkey, nonce } => {
AuthResponsePayload::Challenge(ProtoAuthChallenge {
pubkey: pubkey.to_bytes().to_vec(),
pubkey: pubkey.to_bytes(),
nonce,
})
}
@@ -160,11 +161,7 @@ impl Receiver<auth::Inbound> for AuthTransportAdapter<'_> {
.await;
return None;
};
let Ok(pubkey) = <[u8; 32]>::try_from(pubkey) else {
let _ = self.send_auth_result(ProtoAuthResult::InvalidKey).await;
return None;
};
let Ok(pubkey) = ed25519_dalek::VerifyingKey::from_bytes(&pubkey) else {
let Ok(pubkey) = authn::PublicKey::try_from(pubkey.as_slice()) else {
let _ = self.send_auth_result(ProtoAuthResult::InvalidKey).await;
return None;
};
@@ -174,7 +171,7 @@ impl Receiver<auth::Inbound> for AuthTransportAdapter<'_> {
})
}
AuthRequestPayload::ChallengeSolution(ProtoAuthChallengeSolution { signature }) => {
let Ok(signature) = ed25519_dalek::Signature::try_from(signature.as_slice()) else {
let Ok(signature) = authn::Signature::try_from(signature.as_slice()) else {
let _ = self
.send_auth_result(ProtoAuthResult::InvalidSignature)
.await;