housekeeping(server): clean too-broad visibility markers and organize imports
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use crate::db::{self, DatabasePool, schema};
|
||||
use arbiter_proto::{BOOTSTRAP_PATH, home_path};
|
||||
|
||||
use diesel::QueryDsl;
|
||||
use diesel_async::RunQueryDsl;
|
||||
use kameo::{Actor, messages};
|
||||
|
||||
use rand::{RngExt, distr::Alphanumeric, make_rng, rngs::StdRng};
|
||||
use subtle::ConstantTimeEq as _;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::db::{self, DatabasePool, schema};
|
||||
const TOKEN_LENGTH: usize = 64;
|
||||
|
||||
pub async fn generate_token() -> Result<String, std::io::Error> {
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
use alloy::{consensus::TxEip1559, primitives::Address, signers::Signature};
|
||||
use diesel::{
|
||||
ExpressionMethods, OptionalExtension as _, QueryDsl, SelectableHelper as _, dsl::insert_into,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use kameo::{Actor, actor::ActorRef, messages};
|
||||
use rand::{SeedableRng, rng, rngs::StdRng};
|
||||
|
||||
use crate::{
|
||||
actors::vault::{CreateNew, Decrypt, Vault},
|
||||
crypto::integrity,
|
||||
@@ -24,6 +16,14 @@ use crate::{
|
||||
};
|
||||
use arbiter_crypto::safecell::{SafeCell, SafeCellHandle as _};
|
||||
|
||||
use alloy::{consensus::TxEip1559, primitives::Address, signers::Signature};
|
||||
use diesel::{
|
||||
ExpressionMethods, OptionalExtension as _, QueryDsl, SelectableHelper as _, dsl::insert_into,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use kameo::{Actor, actor::ActorRef, messages};
|
||||
use rand::{SeedableRng, rng, rngs::StdRng};
|
||||
|
||||
pub use crate::evm::safe_signer;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use kameo::{
|
||||
Actor, messages,
|
||||
prelude::{ActorId, ActorRef, ActorStopReason, Context, WeakActorRef},
|
||||
reply::ReplySender,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
actors::flow_coordinator::ApprovalError,
|
||||
peers::{
|
||||
@@ -14,6 +6,13 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use kameo::{
|
||||
Actor, messages,
|
||||
prelude::{ActorId, ActorRef, ActorStopReason, Context, WeakActorRef},
|
||||
reply::ReplySender,
|
||||
};
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
pub struct Args {
|
||||
pub client: ClientProfile,
|
||||
pub user_agents: Vec<ActorRef<UserAgentSession>>,
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
use std::{collections::HashMap, ops::ControlFlow};
|
||||
use crate::{
|
||||
actors::{
|
||||
flow_coordinator::client_connect_approval::ClientApprovalController,
|
||||
useragent_registry::{GetConnected, UserAgentRegistry},
|
||||
},
|
||||
peers::client::{ClientProfile, session::ClientSession},
|
||||
};
|
||||
|
||||
use kameo::{
|
||||
Actor,
|
||||
@@ -7,16 +13,9 @@ use kameo::{
|
||||
prelude::{ActorStopReason, Context, WeakActorRef},
|
||||
reply::DelegatedReply,
|
||||
};
|
||||
use std::{collections::HashMap, ops::ControlFlow};
|
||||
use tracing::info;
|
||||
|
||||
use crate::{
|
||||
actors::{
|
||||
flow_coordinator::client_connect_approval::ClientApprovalController,
|
||||
useragent_registry::{GetConnected, UserAgentRegistry},
|
||||
},
|
||||
peers::client::{ClientProfile, session::ClientSession},
|
||||
};
|
||||
|
||||
pub mod client_connect_approval;
|
||||
|
||||
pub struct FlowCoordinator {
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
use kameo::actor::{ActorRef, Spawn};
|
||||
use kameo_actors::{DeliveryStrategy, message_bus::MessageBus};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{
|
||||
actors::{
|
||||
bootstrap::Bootstrapper,
|
||||
evm::EvmActor,
|
||||
flow_coordinator::FlowCoordinator,
|
||||
useragent_registry::UserAgentRegistry,
|
||||
vault::Vault,
|
||||
bootstrap::Bootstrapper, evm::EvmActor, flow_coordinator::FlowCoordinator,
|
||||
useragent_registry::UserAgentRegistry, vault::Vault,
|
||||
},
|
||||
db,
|
||||
};
|
||||
|
||||
use kameo::actor::{ActorRef, Spawn};
|
||||
use kameo_actors::{DeliveryStrategy, message_bus::MessageBus};
|
||||
use thiserror::Error;
|
||||
|
||||
pub mod bootstrap;
|
||||
pub mod evm;
|
||||
pub mod flow_coordinator;
|
||||
pub mod vault;
|
||||
pub mod useragent_registry;
|
||||
pub mod vault;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum SpawnError {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{collections::HashMap, ops::ControlFlow};
|
||||
use crate::peers::user_agent::UserAgentSession;
|
||||
|
||||
use kameo::{
|
||||
Actor,
|
||||
@@ -7,10 +7,9 @@ use kameo::{
|
||||
messages,
|
||||
prelude::{ActorStopReason, Context, WeakActorRef},
|
||||
};
|
||||
use std::{collections::HashMap, ops::ControlFlow};
|
||||
use tracing::info;
|
||||
|
||||
use crate::peers::user_agent::UserAgentSession;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct UserAgentRegistry {
|
||||
connected: HashMap<ActorId, ActorRef<UserAgentSession>>,
|
||||
@@ -32,7 +31,11 @@ impl Actor for UserAgentRegistry {
|
||||
_: ActorStopReason,
|
||||
) -> Result<ControlFlow<ActorStopReason>, Self::Error> {
|
||||
if self.connected.remove(&id).is_some() {
|
||||
info!(?id, actor = "UserAgentRegistry", event = "useragent.disconnected");
|
||||
info!(
|
||||
?id,
|
||||
actor = "UserAgentRegistry",
|
||||
event = "useragent.disconnected"
|
||||
);
|
||||
}
|
||||
Ok(ControlFlow::Continue(()))
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
use crate::{
|
||||
crypto::{
|
||||
KeyCell, derive_key,
|
||||
encryption::v1::{self, Nonce},
|
||||
integrity::v1::HmacSha256,
|
||||
},
|
||||
db::{
|
||||
self,
|
||||
models::{self, RootKeyHistory},
|
||||
schema::{self},
|
||||
},
|
||||
};
|
||||
use arbiter_crypto::safecell::{SafeCell, SafeCellHandle as _};
|
||||
|
||||
use chrono::Utc;
|
||||
use diesel::{
|
||||
ExpressionMethods as _, OptionalExtension, QueryDsl, SelectableHelper,
|
||||
@@ -10,18 +24,6 @@ use kameo_actors::message_bus::{MessageBus, Publish};
|
||||
use strum::{EnumDiscriminants, IntoDiscriminant};
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::crypto::{
|
||||
KeyCell, derive_key,
|
||||
encryption::v1::{self, Nonce},
|
||||
integrity::v1::HmacSha256,
|
||||
};
|
||||
use crate::db::{
|
||||
self,
|
||||
models::{self, RootKeyHistory},
|
||||
schema::{self},
|
||||
};
|
||||
use arbiter_crypto::safecell::{SafeCell, SafeCellHandle as _};
|
||||
|
||||
pub mod events {
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -213,7 +215,7 @@ impl Vault {
|
||||
});
|
||||
|
||||
info!("Vault bootstrapped successfully");
|
||||
self.events.tell(Publish(events::Bootstrapped)).await;
|
||||
let _ = self.events.tell(Publish(events::Bootstrapped)).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -269,7 +271,7 @@ impl Vault {
|
||||
});
|
||||
|
||||
info!("Vault unsealed successfully");
|
||||
self.events.tell(Publish(events::Unsealed)).await;
|
||||
let _ = self.events.tell(Publish(events::Unsealed)).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -399,7 +401,7 @@ impl Vault {
|
||||
self.state = State::Sealed {
|
||||
root_key_history_id: *root_key_history_id,
|
||||
};
|
||||
self.events.tell(Publish(events::VaultResealed)).await;
|
||||
let _ = self.events.tell(Publish(events::VaultResealed)).await;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user