PkiContext Test Helper
Create a PkiContext struct in tests/integration.rs that wraps the toy-pki modules
and provides high-level methods for the integration test. This keeps test code readable.
struct PkiContext {
dir: TempDir,
root_ca: Ca,
intermediate: Ca,
cert_store: CertStore,
crl_store: CrlStore,
}
impl PkiContext {
async fn init(dir: &Path) -> anyhow::Result<Self> { ... }
async fn issue_server(&mut self, hostname: &str) -> anyhow::Result<String> { ... }
async fn issue_client(&mut self, identity: &str) -> anyhow::Result<String> { ... }
async fn revoke(&mut self, serial: &str, reason: &str) -> anyhow::Result<()> { ... }
async fn echo_connect(&self, identity: &str, msg: &str) -> anyhow::Result<String> { ... }
}