twizzler_security/
delegation.rs

1use alloc::boxed::Box;
2
3use twizzler_abi::object::ObjID;
4
5use crate::{Cap, Gate, Revoc};
6
7#[expect(dead_code)]
8
9/// A Delegation, which can be used to delegate capabilities into other security contexts.
10/// Currently not implemented
11#[derive(Debug)]
12pub struct Del {
13    /// The receiver of this delegation
14    pub receiver: ObjID,
15    /// The provider of this delegation
16    pub provider: ObjID,
17    // mask:
18    // flags:
19    /// The gatemask, read about this in the paper
20    gatemask: Gate,
21    /// When this delegation is revoked
22    revocation: Revoc,
23
24    /// The signature for this delegation
25    sig: heapless::Vec<u8, 1024>,
26    /// Length of data
27    datalen: u32,
28
29    /// What this delegation holds
30    inner: Option<Box<DelInner>>,
31}
32
33/// A delegation can hold a Delegation or a Capability
34#[derive(Debug)]
35pub enum DelInner {
36    /// TODO: docs
37    Delegation(Del),
38    /// TODO: docs
39    Capability(Cap),
40}