use anyhow::Result;
use async_trait::async_trait;
#[async_trait]
pub trait HardwareIdentity: Send + Sync {
async fn seal(&self, label: &str, data: &[u8]) -> Result<Vec<u8>>;
async fn unseal(&self, blob: &[u8]) -> Result<Vec<u8>>;
async fn sign_handshake_hash(&self, hash: &[u8]) -> Result<[u8; 64]>;
async fn dh(&self, remote_public_key: &[u8]) -> Result<[u8; 32]>;
async fn generate_quote(&self, nonce: &[u8]) -> Result<TpmQuote>;
async fn public_key(&self) -> Result<Vec<u8>>;
fn set_sealed_seed(&mut self, _sealed_seed: Vec<u8>) {}
fn set_public_key(&mut self, _pubkey: Vec<u8>) {}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct TpmQuote {
pub message: Vec<u8>,
pub signature: Vec<u8>,
pub pcrs: Vec<(u32, Vec<u8>)>,
}
pub trait NetworkWatchman: Send + Sync {
fn get_process_connections(&self, pid: u32) -> Result<Vec<ConnectionInfo>>;
}
#[derive(Debug, Clone)]
pub struct ConnectionInfo {
pub local_ip: String,
pub local_port: u16,
pub remote_ip: String,
pub remote_port: u16,
pub pid: u32,
pub process_name: String,
}