OpenAgentID documentation
Source referencesRust module referenceopenagent-http

openagent-http · server

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

Source: openagent-sdk/adapters/http/rust/src/server.rs. SHA-256: f5e13912bf968d446ee97104dfd709bc4dfae668cd06db2029c64eee261f1f5e.

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.

server::ServerConfig

Server configuration for the HTTP adapter.

#[derive(Debug, Clone)]
pub struct ServerConfig {
/// The server's origin per RFC 6454 (`scheme://host[:port]`). Bound into

/// every challenge the server issues.

pub origin: String,
/// Optional protection-space identifier.

pub realm: Option<String>,
/// The trust tier assigned to verified agents. Deployments with DID

/// resolution and registry context assign higher tiers in their own

/// policy layer; this adapter's default is key-possession-only.

pub trust_tier: TrustTier,
/// Session TTL in seconds.

pub session_ttl_secs: u32,
/// Challenge TTL in seconds.

pub challenge_ttl_secs: u32
}

Source line: 29.

server::ServerConfig::new

Creates a new server configuration with sensible defaults.

pub fn new(origin: impl Into<String>) -> Self;

Source line: 47.

server::ServerConfig::with_realm

Sets the protection-space identifier.

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

Source line: 58.

server::ServerConfig::with_trust_tier

Sets the trust tier assigned to verified agents.

pub fn with_trust_tier(mut self, tier: TrustTier) -> Self;

Source line: 64.

server::ServerConfig::with_session_ttl

Sets the session TTL.

pub fn with_session_ttl(mut self, secs: u32) -> Self;

Source line: 70.

server::ServerConfig::with_challenge_ttl

Sets the challenge TTL.

pub fn with_challenge_ttl(mut self, secs: u32) -> Self;

Source line: 76.

server::handle_discovery

Handle GET /.well-known/openagent — returns the discovery document.

pub fn handle_discovery(config: &ServerConfig) -> DiscoveryDocument;

Source line: 83.

server::handle_challenge

Handle the challenge step — issue an [IdentityChallenge].

Creates a fresh challenge per Section 4 and records a pending session keyed by the nonce, so the proof step can find exactly one challenge to answer and a nonce can never be answered twice.

pub async fn handle_challenge<S: SessionStore>(
    config: &ServerConfig,
    store: &S,
) -> Result<IdentityChallenge, AuthProtocolError>;

Source line: 97.

server::handle_prove

Handle the prove step — verify an [IdentityProof] and issue a session.

Verification is normative-ordered: shape checks first (nonce echo, key length per scheme), then the pending challenge (present, unexpired), then the signature over the JCS-canonical challenge bytes. The nonce is consumed on success and on signature failure - a failed answer must not be retryable, or a verifier becomes an oracle.

pub async fn handle_prove<S: SessionStore>(
    config: &ServerConfig,
    store: &S,
    proof: &IdentityProof,
) -> Result<IdentityVerified, AuthProtocolError>;

Source line: 137.

server::validate_authenticated_request

Validate an authenticated request by checking the session store.

Looks up the session by its token, verifies it is established and not expired, and returns it.

pub async fn validate_authenticated_request<S: SessionStore>(
    store: &S,
    session_token: &str,
) -> Result<Session, AuthProtocolError>;

Source line: 256.

On this page