1#[cfg(feature = "qssh")]
4pub mod qssh;
5
6pub mod traits {
8 use async_trait::async_trait;
9 use serde::{Serialize, Deserialize};
10
11 #[async_trait]
13 pub trait TransportIntegration: Send + Sync {
14 async fn send_data(&self, data: &[u8]) -> Result<(), Box<dyn std::error::Error>>;
16
17 async fn recv_data(&self) -> Result<Vec<u8>, Box<dyn std::error::Error>>;
19
20 fn is_connected(&self) -> bool;
22 }
23
24 #[async_trait]
26 pub trait SessionIntegration: Send + Sync {
27 async fn store_session(&self, id: &[u8], data: &[u8]) -> Result<(), Box<dyn std::error::Error>>;
29
30 async fn get_session(&self, id: &[u8]) -> Result<Option<Vec<u8>>, Box<dyn std::error::Error>>;
32
33 async fn remove_session(&self, id: &[u8]) -> Result<bool, Box<dyn std::error::Error>>;
35 }
36
37 pub trait KeyIntegration: Send + Sync {
39 fn derive_keys(&self, master_secret: &[u8]) -> Result<SessionKeys, Box<dyn std::error::Error>>;
41
42 fn export_keying_material(&self, label: &str, length: usize) -> Result<Vec<u8>, Box<dyn std::error::Error>>;
44 }
45
46 #[derive(Debug, Clone)]
48 pub struct SessionKeys {
49 pub client_write_key: Vec<u8>,
50 pub server_write_key: Vec<u8>,
51 pub client_write_iv: Vec<u8>,
52 pub server_write_iv: Vec<u8>,
53 }
54}