This commit is contained in:
2026-01-26 17:09:40 -05:00
parent 53ed4775ae
commit a8b55f669f
8 changed files with 656 additions and 252 deletions

View File

@@ -1,4 +1,4 @@
use rand::TryRngCore;
use rand::TryRng;
#[repr(u32)]
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
@@ -21,6 +21,7 @@ pub enum ServerMsgInst {
pub struct CreateAccountV0 {
pub username: String,
pub password: String,
pub token: String,
pub login_key: LoginKeyV0,
}
@@ -35,7 +36,7 @@ impl LoginKeyV0 {
pub fn new() -> Self {
let mut key = [0u8; Self::BYTE_LEN];
rand::rngs::OsRng
rand::rngs::SysRng
.try_fill_bytes(&mut key)
.expect("failed to generate random key");
Self(key.to_vec())

View File

@@ -27,3 +27,9 @@ impl From<CreateAccount> for ClientMsg {
Self::CreateAccount(value)
}
}
impl From<ServerError> for ServerMsg {
fn from(value: ServerError) -> Self {
Self::ServerError(value)
}
}