pub struct CapabilityToken {
pub token_id: String,
pub parent_token_id: Option<String>,
pub issuer: String,
pub holder: String,
pub grants: Vec<CapabilityGrant>,
pub remaining_depth: u8,
pub issued_at: String,
pub expires_at: String,
pub signature: String,
pub issuer_public_key: String,
}Expand description
A capability-based delegation token granting specific tool permissions.
Tokens form a delegation chain: each token can optionally reference a
parent token, and its grants must be a subset of the parent’s grants.
The remaining_depth decrements with each delegation, preventing
unbounded chains.
Fields§
§token_id: StringUnique token identifier (UUID v4).
parent_token_id: Option<String>Parent token ID if this was delegated (None for root tokens).
issuer: StringIdentity of the token issuer (who signed it).
holder: StringIdentity of the token holder (who can use it).
grants: Vec<CapabilityGrant>Permissions granted by this token.
remaining_depth: u8Remaining delegation depth (0 = terminal, cannot delegate further).
issued_at: StringISO 8601 timestamp when the token was issued.
expires_at: StringISO 8601 timestamp when the token expires.
signature: StringEd25519 signature over the canonical token content (hex-encoded).
issuer_public_key: StringEd25519 public key of the issuer (hex-encoded).
Implementations§
Source§impl CapabilityToken
impl CapabilityToken
Sourcepub fn validate_structure(&self) -> Result<(), CapabilityError>
pub fn validate_structure(&self) -> Result<(), CapabilityError>
Validate the structural integrity of the token.
Checks bounds on grants, depth, field lengths, and serialized size.