OpenAgentID documentation
Source referencesRust module referencearsenal-sdk

arsenal-sdk · broker_client

Declared module signatures, types, configuration, and source documentation.

Source: arsenal/crates/arsenal-sdk/src/broker_client.rs. SHA-256: 31f8a91c90e0c4af3a52b899bd085073fb13ca70a5f34780bda2c3d5220cb17d.

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.

broker_client::BrokerClient

HTTP client for broker communication

pub struct BrokerClient {

}

Source line: 15.

broker_client::CapabilityRequestPayload

Request payload for capability requests

#[derive(Debug, Clone, Serialize)]
pub struct CapabilityRequestPayload {
/// Requested scopes

pub scopes: Vec<String>,
/// Requested TTL in seconds

#[serde(skip_serializing_if = "Option::is_none")]
pub ttl_seconds: Option<i64>,
/// Target audience (service)

pub audience: String,
/// Constraints to apply

#[serde(skip_serializing_if = "Option::is_none")]
pub constraints: Option<ConstraintsPayload>,
/// `PoP` key fingerprint (hex encoded)

#[serde(skip_serializing_if = "Option::is_none")]
pub pop_key_fingerprint: Option<String>
}

Source line: 26.

broker_client::ConstraintsPayload

Constraints payload for API

#[derive(Debug, Clone, Default, Serialize)]
pub struct ConstraintsPayload {
/// Require proof-of-possession

#[serde(skip_serializing_if = "std::ops::Not::not")]
pub require_pop: bool,
/// Allowed origins

#[serde(skip_serializing_if = "Option::is_none")]
pub allowed_origins: Option<Vec<String>>,
/// Device ID binding

#[serde(skip_serializing_if = "Option::is_none")]
pub device_id: Option<String>
}

Source line: 44.

broker_client::CapabilityResponsePayload

Response payload from capability requests

#[derive(Debug, Deserialize)]
pub struct CapabilityResponsePayload {
/// Token ID

pub token_id: String,
/// Encoded token (base64)

pub token: String,
/// Expiration timestamp (ISO 8601)

pub expires_at: String,
/// Granted scopes

pub granted_scopes: Vec<String>
}

Source line: 58.

broker_client::SecretRequestPayload

Request payload for secret requests

#[derive(Debug, Serialize)]
pub struct SecretRequestPayload {
/// Secret ID

pub secret_id: String,
/// Version (optional, defaults to latest)

#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<u64>,
/// Capability token authorizing access

pub capability_token: String
}

Source line: 71.

broker_client::SecretResponsePayload

Response payload from secret requests

#[derive(Debug, Deserialize)]
pub struct SecretResponsePayload {
/// Secret ID

pub secret_id: String,
/// Version

pub version: u64,
/// Wrapped (encrypted) secret value (base64)

pub wrapped_value: String,
/// Wrapping key ID

pub wrap_key_id: String,
/// Ephemeral public key for unwrapping (base64)

pub ephemeral_public_key: String,
/// Expiration timestamp (ISO 8601)

pub expires_at: String
}

Source line: 83.

broker_client::RevokeTokenPayload

Request payload for token revocation

#[derive(Debug, Serialize)]
pub struct RevokeTokenPayload {
/// Token ID to revoke

pub token_id: String,
/// Reason for revocation

#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>
}

Source line: 100.

broker_client::RevokeTokenResponse

Response from token revocation

#[derive(Debug, Deserialize)]
pub struct RevokeTokenResponse {
/// Whether revocation succeeded

pub success: bool,
/// Message

pub message: String
}

Source line: 110.

broker_client::ApiErrorResponse

API error response from broker

#[derive(Debug, Deserialize)]
pub struct ApiErrorResponse {
/// Error code

pub code: u32,
/// Error message

pub message: String,
/// Correlation ID

#[serde(default)]
pub correlation_id: Option<String>,
/// Retry after (seconds)

#[serde(default)]
pub retry_after: Option<u64>
}

Source line: 119.

broker_client::HealthResponse

Health check response

#[derive(Debug, Deserialize)]
pub struct HealthResponse {
/// Service status

pub status: String,
/// Service version

pub version: String
}

Source line: 134.

broker_client::BrokerClient::new

Create a new broker client

Arguments

  • base_url - Base URL of the broker (e.g., https://broker.example.com)
  • client - Preconfigured HTTP client (must include mTLS identity for production)

Errors

Returns an error if the broker URL is invalid

pub fn new(base_url: impl Into<String>, client: reqwest::Client) -> ArsenalResult<Self>;

Source line: 150.

broker_client::BrokerClient::with_timeout

Create with custom timeout

#[must_use]
pub fn with_timeout(mut self, timeout: Duration) -> Self;

Source line: 160.

broker_client::BrokerClient::health

Check broker health

Errors

Returns an error if the health check fails

Returns

The health response

pub async fn health(&self) -> ArsenalResult<HealthResponse>;

Source line: 172.

broker_client::BrokerClient::request_capability

Request a capability token from the broker

Arguments

  • payload - The capability request payload

Errors

Returns an error if the request fails or is denied

pub async fn request_capability(
        &self,
        payload: CapabilityRequestPayload,
    ) -> ArsenalResult<CapabilityResponsePayload>;

Source line: 210.

broker_client::BrokerClient::request_secret

Request a secret from the broker

Arguments

  • payload - The secret request payload

Errors

Returns an error if the request fails or is denied

pub async fn request_secret(
        &self,
        payload: SecretRequestPayload,
    ) -> ArsenalResult<SecretResponsePayload>;

Source line: 241.

broker_client::BrokerClient::revoke_token

Revoke a token

Arguments

  • token_id - The token ID to revoke
  • reason - Optional reason for revocation

Errors

Returns an error if revocation fails

pub async fn revoke_token(
        &self,
        token_id: &str,
        reason: Option<&str>,
    ) -> ArsenalResult<RevokeTokenResponse>;

Source line: 273.

broker_client::BrokerClient::proxy_request

Send a proxy request through the broker.

Arguments

  • request - The proxy request
  • fingerprint_hex - Optional hex-encoded fingerprint for chain verification

Errors

Returns an error if the request fails or is rejected.

pub async fn proxy_request(
        &self,
        request: arsenal_core::proxy::ProxyRequest,
        fingerprint_hex: Option<&str>,
    ) -> ArsenalResult<arsenal_core::proxy::ProxyResponse>;

Source line: 311.

Approve a consent request.

Errors

Returns an error if the approval fails.

pub async fn approve_consent(
        &self,
        payload: ConsentApprovalPayload,
    ) -> ArsenalResult<ConsentRecordPayload>;

Source line: 385.

broker_client::BrokerClient::list_consents

List consent records for an agent.

Errors

Returns an error if the request fails.

pub async fn list_consents(&self, agent_did: &str) -> ArsenalResult<Vec<ConsentRecordPayload>>;

Source line: 413.

broker_client::ProxyRequestPayload

Request payload for proxy requests

#[derive(Debug, Serialize)]
pub struct ProxyRequestPayload {
/// HTTP method

pub method: String,
/// Target URL (may contain `{{VARIABLE}}` placeholders)

pub url: String,
/// Optional HTTP headers

#[serde(skip_serializing_if = "Option::is_none")]
pub headers: Option<std::collections::BTreeMap<String, String>>,
/// Optional request body (base64-encoded)

#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
/// Capability token authorizing this request

pub capability_token: String,
/// Optional timeout in milliseconds

#[serde(skip_serializing_if = "Option::is_none")]
pub timeout_ms: Option<u64>
}

Source line: 489.

broker_client::ProxyResponsePayload

Response payload from proxy requests

#[derive(Debug, Deserialize)]
pub struct ProxyResponsePayload {
/// HTTP status code from target API

pub status: u16,
/// Response headers (sanitized)

pub headers: std::collections::BTreeMap<String, String>,
/// Response body (base64-encoded)

pub body: String,
/// Proxy processing metadata

pub proxy_metadata: ProxyMetadataPayload
}

Source line: 509.

broker_client::ProxyMetadataPayload

Metadata about proxy processing

#[derive(Debug, Deserialize)]
pub struct ProxyMetadataPayload {
/// Variable names that were resolved

pub variables_resolved: Vec<String>,
/// Whether destination binding was verified

pub destination_verified: bool,
/// Whether agent fingerprint was verified

pub fingerprint_verified: bool,
/// Consent status

pub consent_status: String,
/// End-to-end latency in milliseconds

pub latency_ms: u64,
/// Request ID for audit correlation

pub request_id: String
}

Source line: 522.

broker_client::ConsentApprovalPayload

Request payload for consent approval

#[derive(Debug, Serialize)]
pub struct ConsentApprovalPayload {
/// Agent DID

pub agent_did: String,
/// Human root DID

pub human_root_did: String,
/// Variables to authorize

pub variables: Vec<String>,
/// Destination domains

pub destination_domains: Vec<String>,
/// Scopes

pub scopes: Vec<String>,
/// TTL in seconds

pub ttl_seconds: u64,
/// Ed25519 signature (base64)

pub signature: String
}

Source line: 539.

broker_client::ConsentRecordPayload

Response payload from consent approval

#[derive(Debug, Deserialize)]
pub struct ConsentRecordPayload {
/// Consent record ID

pub consent_id: String,
/// Agent DID

pub agent_did: String,
/// Granted at timestamp (ISO 8601)

pub granted_at: String,
/// Expires at timestamp (ISO 8601)

pub expires_at: String,
/// Variables authorized

pub variables: Vec<String>
}

Source line: 558.

broker_client::ConsentListPayload

Summary payload for consent listing

#[derive(Debug, Deserialize)]
pub struct ConsentListPayload {
/// List of consent records

pub consents: Vec<ConsentRecordPayload>
}

Source line: 573.

broker_client::decode_capability_token

Decode a capability token from the broker response

Arguments

  • response - The capability response from the broker

Errors

Returns an error if the token cannot be decoded

pub fn decode_capability_token(
    response: &CapabilityResponsePayload,
) -> ArsenalResult<AgentCapabilityToken>;

Source line: 597.

On this page