settle on key_store for a name

This commit is contained in:
StripedMonkey 2024-09-12 18:48:22 -04:00
parent c13261ba20
commit 8bf8ba14da
2 changed files with 8 additions and 10 deletions

View File

@ -6,13 +6,13 @@ use sha2::Digest;
use crate::client::EncryptionError; use crate::client::EncryptionError;
pub struct BikeShedKeyStore { pub struct KeyStore {
pub _public_key: RsaPublicKey, pub _public_key: RsaPublicKey,
pub private_key: RsaPrivateKey, pub private_key: RsaPrivateKey,
pub public_key_der: Box<[u8]>, pub public_key_der: Box<[u8]>,
} }
impl BikeShedKeyStore { impl KeyStore {
pub fn new() -> Self { pub fn new() -> Self {
log::debug!("Creating encryption keys..."); log::debug!("Creating encryption keys...");
let (public_key, private_key) = Self::generate_keys(); let (public_key, private_key) = Self::generate_keys();
@ -22,7 +22,7 @@ impl BikeShedKeyStore {
&private_key.e().to_bytes_be(), &private_key.e().to_bytes_be(),
) )
.into_boxed_slice(); .into_boxed_slice();
BikeShedKeyStore { KeyStore {
_public_key: public_key, _public_key: public_key,
private_key, private_key,
public_key_der, public_key_der,

View File

@ -1,4 +1,4 @@
use bikeshed_key_store::BikeShedKeyStore; use key_store::KeyStore;
use bikeshed_server_listing::BikeShedServerListing; use bikeshed_server_listing::BikeShedServerListing;
use mio::Token; use mio::Token;
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
@ -31,13 +31,11 @@ use crate::{
world::World, world::World,
}; };
mod bikeshed_key_store; mod key_store;
mod bikeshed_server_listing;
pub const CURRENT_MC_VERSION: &str = "1.21.1"; pub const CURRENT_MC_VERSION: &str = "1.21.1";
pub struct Server { pub struct Server {
key_store: BikeShedKeyStore, key_store: KeyStore,
server_listing: BikeShedServerListing,
pub plugin_loader: PluginLoader, pub plugin_loader: PluginLoader,
pub command_dispatcher: Arc<CommandDispatcher<'static>>, pub command_dispatcher: Arc<CommandDispatcher<'static>>,
@ -58,7 +56,7 @@ impl Server {
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
pub fn new() -> Self { pub fn new() -> Self {
// TODO: only create when needed // TODO: only create when needed
let key_store = BikeShedKeyStore::new();
let server_listing = BikeShedServerListing::new(); let server_listing = BikeShedServerListing::new();
let auth_client = if BASIC_CONFIG.online_mode { let auth_client = if BASIC_CONFIG.online_mode {
Some( Some(
@ -90,7 +88,7 @@ impl Server {
worlds: vec![Arc::new(world)], worlds: vec![Arc::new(world)],
command_dispatcher: Arc::new(command_dispatcher), command_dispatcher: Arc::new(command_dispatcher),
auth_client, auth_client,
key_store, key_store: KeyStore::new(),
server_listing, server_listing,
} }
} }