typesec-agent
Agent executor: typestate + capability-based access control in action.
This crate provides the high-level [SecureAgent] API that ties together:
- The typestate machine from
typesec-core(unauthenticated → authenticated). - Runtime policy checking via any [
PolicyEngine]. - Typed capability acquisition: the only way to get a
Capability<P, R>is through a successful policy check. - Async task execution: the
executemethod requires a capability as proof.
Usage Pattern
// 1. Create agent with an engine — starts Unauthenticated.
let agent = new;
// 2. Authenticate — type transitions to Authenticated.
let agent = agent.authenticate_unverified?;
// 3. Request a capability — policy checked at runtime, cap minted on success.
let report = new;
let cap: = agent.request_capability.await?;
// 4. Execute — cap is required proof. No cap? Won't compile.
agent.execute.await?;