OpenAgentID documentation
Source referencesRust module referenceopenagent-server

openagent-server · config

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

Source: openagents/openagent.id/crates/openagent-server/src/config.rs. SHA-256: f3287273cd30315d8e25093d429ce61c9652b3de24c912e28e60537d18be424c.

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.

config::OpenAgentConfig

Configuration for the OpenAgent server middleware.

#[derive(Debug, Clone)]
pub struct OpenAgentConfig {
/// Server origin for challenge generation (e.g., "https://api.example.com").

pub origin: String,
/// Optional realm for challenge generation.

pub realm: Option<String>,
/// Challenge nonce TTL. Default: 30 seconds.

pub nonce_ttl: Duration,
/// Session token TTL in seconds. Default: 900 (15 minutes).

pub session_ttl_secs: i64,
/// HMAC secret for signing session JWTs. Must be at least 32 bytes.

pub session_secret: Vec<u8>,
/// Minimum trust tier required for this service. Default: 0 (Anonymous).

pub min_trust_tier: u8,
/// Require privileged lineage authority for this service.

///

/// During containment this is a deny-only gate because no hardened lineage

/// verifier result type is available.

pub require_privileged_authority: bool,
/// Required authority path kind when privileged authority is required.

pub required_authority_path: Option<String>,
/// Scopes that must be present in the privileged authority context.

pub required_authority_scopes: Vec<String>,
/// Optional minimum finalized block for accepted authority context.

pub min_authority_finalized_block: Option<u64>
}

Source line: 9.

config::OpenAgentConfig::new

Creates a new config with the given origin and session secret.

All other fields use protocol defaults.

pub fn new(origin: impl Into<String>, session_secret: impl Into<Vec<u8>>) -> Self;

Source line: 48.

config::OpenAgentConfig::with_realm

Sets the optional realm.

pub fn with_realm(mut self, realm: impl Into<String>) -> Self;

Source line: 64.

config::OpenAgentConfig::with_min_trust_tier

Sets the minimum trust tier.

pub fn with_min_trust_tier(mut self, tier: u8) -> Self;

Source line: 70.

config::OpenAgentConfig::with_nonce_ttl

Sets the nonce TTL.

pub fn with_nonce_ttl(mut self, ttl: Duration) -> Self;

Source line: 76.

config::OpenAgentConfig::with_session_ttl_secs

Sets the session token TTL.

pub fn with_session_ttl_secs(mut self, secs: i64) -> Self;

Source line: 82.

config::OpenAgentConfig::with_privileged_authority

Enables the deny-only privileged-lineage gate and pins the path kind.

This method cannot restore legacy authorization. Requests remain denied until a separately reviewed hardened verifier API is introduced.

pub fn with_privileged_authority(mut self, path_kind: impl Into<String>) -> Self;

Source line: 91.

config::OpenAgentConfig::with_required_authority_scopes

Adds scopes that the privileged authority context must prove.

pub fn with_required_authority_scopes(mut self, scopes: Vec<String>) -> Self;

Source line: 98.

config::OpenAgentConfig::with_min_authority_finalized_block

Sets the minimum finalized authority block.

pub fn with_min_authority_finalized_block(mut self, block: u64) -> Self;

Source line: 104.

On this page