arsenal-core · consent
Declared module signatures, types, configuration, and source documentation.
Source: arsenal/crates/arsenal-core/src/consent.rs. SHA-256: 7e190e9a4d86a5cd1177f2673c7134f73806ae4a4816fd658f564d477e7db94f.
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.
consent::ConsentId
Unique identifier for a consent record
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ConsentId(Uuid);Source line: 38.
consent::ConsentId::generate
Generate a new consent ID
#[must_use]
pub fn generate() -> Self;Source line: 43.
consent::ConsentId::from_uuid
Create from an existing UUID
#[must_use]
pub const fn from_uuid(uuid: Uuid) -> Self;Source line: 49.
consent::ConsentId::as_uuid
Get the inner UUID
#[must_use]
pub const fn as_uuid(&self) -> &Uuid;Source line: 55.
consent::ConsentRecord
A signed consent record authorizing agent credential access.
Consent records are immutable once created. They can be revoked but
never modified. The signature field contains an Ed25519 signature
over the canonical CBOR encoding of the record (excluding the signature
and revocation fields).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConsentRecord {
/// Unique consent record ID
pub consent_id: ConsentId,
/// Tenant this consent record belongs to (multi-tenant isolation)
pub tenant_id: TenantId,
/// DID of the agent granted access
pub agent_did: String,
/// DID of the human who granted consent
pub human_root_did: String,
/// Template variable names the agent may access
pub variables: Vec<String>,
/// Target domains the agent may reach with these credentials
pub destination_domains: Vec<String>,
/// Scopes the consent covers
pub scopes: Vec<String>,
/// Human-readable identifier of who granted consent
pub granted_by: String,
/// When consent was granted
pub granted_at: chrono::DateTime<chrono::Utc>,
/// When this consent expires
pub expires_at: chrono::DateTime<chrono::Utc>,
/// Ed25519 signature by the human over canonical record bytes
pub signature: Vec<u8>,
/// Whether this consent can be revoked (always true)
#[serde(default = "default_revocable")]
pub revocable: bool,
/// Whether this consent has been revoked
#[serde(default)]
pub revoked: bool,
/// When this consent was revoked, if applicable
#[serde(default, skip_serializing_if = "Option::is_none")]
pub revoked_at: Option<chrono::DateTime<chrono::Utc>>
}Source line: 79.
consent::ConsentRecord::is_valid
Check if this consent record is currently valid.
A record is valid if it is not revoked and has not expired.
#[must_use]
pub fn is_valid(&self) -> bool;Source line: 123.
consent::ConsentRecord::covers_variable
Check if this consent covers a specific variable.
#[must_use]
pub fn covers_variable(&self, variable: &str) -> bool;Source line: 129.
consent::ConsentRecord::covers_domain
Check if this consent covers a specific domain.
#[must_use]
pub fn covers_domain(&self, domain: &str) -> bool;Source line: 135.
consent::ConsentRecord::revoke
Revoke this consent record.
pub fn revoke(&mut self);Source line: 143.
consent::ConsentRecord::signing_bytes
Get the canonical bytes for signing/verification.
Serializes all fields except signature, revoked, and revoked_at
to a deterministic CBOR representation.
Errors
Returns an error if serialization fails.
pub fn signing_bytes(&self) -> ArsenalResult<Vec<u8>>;Source line: 156.
consent::ConsentPolicy
Consent policy determining the granularity of consent checks.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ConsentPolicy {
/// Consent required for each individual variable
#[default]
PerVariable,
/// Consent required per provider/service
PerProvider,
/// Consent required per agent (blanket consent)
PerAgent,
}Source line: 199.
consent::ConsentPolicy::as_str
Get the string representation
#[must_use]
pub const fn as_str(&self) -> &'static str;Source line: 212.
consent::ConsentStatus
Status of consent for a credential operation.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ConsentStatus {
/// Consent was pre-approved (e.g., by policy)
PreApproved,
/// Consent has been explicitly approved by a human
Approved,
/// Consent is pending human review
Pending,
/// Consent was explicitly denied
Denied,
/// Consent was previously granted but has been revoked
Revoked,
/// Consent is not required for this operation
NotRequired,
}Source line: 232.
consent::ConsentStatus::allows_operation
Check if this status allows the operation to proceed.
#[must_use]
pub const fn allows_operation(&self) -> bool;Source line: 250.
consent::ConsentStatus::as_str
Get the string representation
#[must_use]
pub const fn as_str(&self) -> &'static str;Source line: 256.
consent::ConsentRequest
A request for consent from an agent.
Created when an agent attempts to access credentials that require human consent. The broker holds the proxy request until consent is granted or denied.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConsentRequest {
/// Unique request ID
pub request_id: Uuid,
/// DID of the requesting agent
pub agent_did: String,
/// DID of the human who must approve
pub human_root_did: String,
/// Variables the agent wants to access
pub variables: Vec<String>,
/// Destination domains the agent wants to reach
pub destination_domains: Vec<String>,
/// Scopes being requested
pub scopes: Vec<String>,
/// When this request was created
pub created_at: chrono::DateTime<chrono::Utc>,
/// When this request expires if not acted upon
pub expires_at: chrono::DateTime<chrono::Utc>
}Source line: 280.
consent::ConsentRequest::new
Create a new consent request.
Errors
Returns an error if validation fails.
pub fn new(
agent_did: impl Into<String>,
human_root_did: impl Into<String>,
variables: Vec<String>,
destination_domains: Vec<String>,
scopes: Vec<String>,
) -> ArsenalResult<Self>;Source line: 305.
consent::ConsentRequest::is_expired
Check if this consent request has expired.
#[must_use]
pub fn is_expired(&self) -> bool;Source line: 350.