agent-capability-token · claims
Declared module signatures, types, configuration, and source documentation.
Source: act/agent-capability-token/src/claims.rs. SHA-256: 86db89e62b3fa97ec758d96d606bec63495b139630cc33fc19854b074155732d.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
claims::Confirmation
Proof-of-possession binding.
ANVIL section 5.2 requires that an ACT be bound to the agent's OAS DID by proof-of-possession. A verifier that ignores this claim cannot tell a legitimate holder from someone replaying a captured token, which is why it is typed here rather than left to the extension map.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Confirmation {
/// Fingerprint of the key the holder must demonstrate control of.
pub key_fingerprint: String,
/// Algorithm the fingerprint and possession proof use, for example
/// `"Ed25519"`.
pub alg: String
}Source line: 31.
claims::Delegation
Constraints governing whether and how this token may be delegated onward.
ANVIL section 5.2 requires that an agent not delegate capabilities it does not hold, and that child capabilities be a strict subset of the parent's.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Delegation {
/// Whether onward delegation is permitted at all.
pub allow_delegation: bool,
/// Remaining delegation depth. Zero forbids further delegation.
pub max_depth: u8,
/// Subset of scopes that may be delegated. `None` means the holder's full
/// scope set is delegatable, subject to `allow_delegation`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub delegatable_scopes: Option<Vec<Scope>>,
/// Whether any recipient may receive a delegation.
pub allow_any_delegate: bool,
/// DIDs permitted to receive a delegation when `allow_any_delegate` is
/// false.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub allowed_delegates: Vec<String>,
/// Minimum reduction in lifetime, in seconds, that a delegated token must
/// apply relative to this one.
#[serde(default)]
pub min_ttl_reduction_seconds: i64
}Source line: 44.
claims::ActClaims
The claim set carried inside an ACT envelope.
Field names are the wire keys. Unknown top-level keys are ignored on decode
so that a newer issuer can add typed claims without breaking existing
verifiers; issuer-specific claims belong in [ActClaims::ext] instead.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ActClaims {
/// Token identifier, unique per issuance. Text, not bytes - a UUID here is
/// carried in its canonical hyphenated form.
pub jti: String,
/// Subject: the OAS DID of the agent this token was issued to.
pub sub: String,
/// Issuer: the broker instance that minted this token.
pub iss: String,
/// Audiences this token is valid for.
///
/// Decodes from either a single string or an array of strings, since a
/// single-audience token is the common case and writing it as a bare string
/// is the conventional CBOR/JWT shorthand.
#[serde(deserialize_with = "audience_from_string_or_array")]
pub aud: Vec<String>,
/// Issued-at time, in seconds since the Unix epoch.
pub iat: i64,
/// Not-before time, in seconds since the Unix epoch.
#[serde(default)]
pub nbf: i64,
/// Expiry time, in seconds since the Unix epoch.
pub exp: i64,
/// Tenant this token is scoped to.
pub tenant_id: String,
/// Granted capability scopes, as a flat array.
pub scope: Vec<Scope>,
/// Proof-of-possession binding. See [`Confirmation`].
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cnf: Option<Confirmation>,
/// Onward delegation constraints. See [`Delegation`].
#[serde(default, skip_serializing_if = "Option::is_none")]
pub delegation: Option<Delegation>,
/// Issuer-defined claims, carried inside the signature and passed through
/// unaltered.
///
/// This is where rate limits, budgets, device and network bindings, and
/// audit trace belong. A verifier that does not understand a key here must
/// preserve it rather than drop it, so that a downstream component which
/// does understand it still receives an intact, signed value.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub ext: BTreeMap<String, ciborium::Value>
}Source line: 71.
claims::ActClaims::validate_structure
Checks the claim set is structurally sound, independent of signature or clock.
Called during verification before any policy check. Kept public so an issuer can reject a malformed claim set at mint time rather than discovering it at the verifier.
Errors
Returns [ActError::EmptyClaim] for a required claim that is blank, and
[ActError::EmptyValidityWindow] if nbf is not before exp.
pub fn validate_structure(&self) -> ActResult<()>;Source line: 155.
claims::ActClaims::authorizes
Whether the granted scopes authorize requested.
Wildcards in the grant expand; wildcards in the request do not. See
[Scope::covers].
#[must_use]
pub fn authorizes(&self, requested: &Scope) -> bool;Source line: 186.
claims::ActClaims::has_audience
Whether this token lists audience among its audiences.
#[must_use]
pub fn has_audience(&self, audience: &str) -> bool;Source line: 192.