mod auth;
mod bridge;
pub mod diagnostics;
mod funcs;
mod keys;
mod pty;
mod run;
mod runtime;
mod state;
mod types;
mod validate;
pub use funcs::{module_with, module_with_endpoints};
use oxdock_core::HostModule;
pub use oxdock_process::DefaultProcessManager;
pub use types::{SshServerTag, SshSessionTag};
pub fn generate_password() -> String {
use aes_gcm::aead::Generate;
use aes_gcm::{Aes256Gcm, Key};
let key = Key::<Aes256Gcm>::generate();
hex::encode(key)
}
pub fn module() -> HostModule<DefaultProcessManager> {
module_with()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn generated_passwords_are_unique_hex() {
let a = generate_password();
let b = generate_password();
assert_eq!(a.len(), 64, "256 bits render as 64 hex chars");
assert!(
a.chars().all(|c| c.is_ascii_hexdigit()),
"hex only, safe in scripts and shells"
);
assert_ne!(a, b, "two draws must differ");
}
}