encrypted msg + online reporting + refactor

This commit is contained in:
JMARyA 2025-04-30 09:35:21 +02:00
parent 125d50530d
commit a567214f58
19 changed files with 318 additions and 304 deletions

24
src/herd_core/model.rs Normal file
View file

@ -0,0 +1,24 @@
use crate::api;
use crate::generate_token;
use owl::prelude::*;
#[model]
pub struct Machine {
pub id: Id,
pub hostname: String,
pub token: String,
pub identity: (String, String),
pub next_token: Option<String>,
}
impl Machine {
pub fn from_join_param(join: api::JoinParams) -> Self {
Self {
id: Id::String(join.machine_id.trim().to_string()),
hostname: join.hostname.trim().to_string(),
identity: join.identity,
token: generate_token(),
next_token: None,
}
}
}