refactor(server): moved shared module crypto into arbiter-crypto

This commit is contained in:
hdbg
2026-04-07 15:41:50 +02:00
committed by Skipper
parent 97b7b483ff
commit 6b814f4869
40 changed files with 319 additions and 209 deletions

View File

@@ -1,5 +1,6 @@
use arbiter_crypto::authn::{self, CLIENT_CONTEXT};
use arbiter_proto::{
CLIENT_CONTEXT, ClientMetadata,
ClientMetadata,
transport::{Bi, expect_message},
};
use chrono::Utc;
@@ -17,7 +18,6 @@ use crate::{
flow_coordinator::{self, RequestClientApproval},
keyholder::KeyHolder,
},
crypto::authn,
crypto::integrity::{self, AttestationStatus},
db::{
self,
@@ -26,8 +26,6 @@ use crate::{
},
};
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
pub enum Error {
#[error("Database pool unavailable")]
@@ -355,7 +353,10 @@ where
T: Bi<Inbound, Result<Outbound, Error>> + ?Sized,
{
transport
.send(Ok(Outbound::AuthChallenge { pubkey: pubkey.clone(), nonce }))
.send(Ok(Outbound::AuthChallenge {
pubkey: pubkey.clone(),
nonce,
}))
.await
.map_err(|e| {
error!(error = ?e, "Failed to send auth challenge");

View File

@@ -1,10 +1,10 @@
use arbiter_crypto::authn;
use arbiter_proto::{ClientMetadata, transport::Bi};
use kameo::actor::Spawn;
use tracing::{error, info};
use crate::{
actors::{GlobalActors, client::session::ClientSession},
crypto::authn,
crypto::integrity::{Integrable, hashing::Hashable},
db,
};
@@ -50,10 +50,7 @@ where
T: Bi<auth::Inbound, Result<auth::Outbound, auth::Error>> + Send + ?Sized,
{
let fut = auth::authenticate(&mut props, transport);
println!(
"authenticate future size: {}",
std::mem::size_of_val(&fut)
);
println!("authenticate future size: {}", std::mem::size_of_val(&fut));
match fut.await {
Ok(client_id) => {
ClientSession::spawn(ClientSession::new(props, client_id));