calternal_imap::session
Execute shared IMAP commands on an authenticated message store (#428/#486, DESIGN §§9, 53). The selected sequence view stays stable until refresh; UID ranges are tested against actual rows, never expanded into attacker-sized vectors. This module is transport-independent and never logs command bytes.
Source: crates/calternal-imap/src/session.rs
Structs
Section titled “Structs”Session
Section titled “Session”pub struct Session<P>One authenticated connection, bound permanently to its provider’s User.
Session::new
Section titled “Session::new”pub fn new(provider: P) -> SelfAuthentication belongs to the listener; no unauthenticated constructor or command can choose another User through this capability (#428).
Session::run
Section titled “Session::run”pub async fn run<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin>( &mut self, reader: &mut crate::wire::CommandReader<S>, idle_timeout: std::time::Duration, ) -> std::io::Result<()>Run commands after TLS and App Password authentication. One subscription lasts for the connection, so IDLE entry cannot miss a committed change. No transport or authentication material escapes into provider errors.
Session::execute
Section titled “Session::execute”pub async fn execute(&mut self, command: Command<'_>) -> Vec<u8>Execute one decoded command. Unsupported requests fail before emitting partial FETCH data. Tags came from the codec’s validated atom grammar.
Session::refresh
Section titled “Session::refresh”pub async fn refresh(&mut self, output: &mut Vec<u8>) -> Result<(), &'static str>IDLE and NOOP share this reconciliation. Emit descending EXPUNGE sequence numbers, then EXISTS and MODSEQ; connection state changes only after a complete provider snapshot. An unchanged durable clock skips body reads; a changed clock retains the full atomic refresh (#428, #780).