OpenAgentID documentation
Source referencesRust module referenceopenagent-http

openagent-http · axum

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

Source: openagent-sdk/adapters/http/rust/src/axum.rs. SHA-256: cfdd6182f5b3b456e5e000560b61735b50ac4bd786b8dae6dddb65a1157766e8.

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.

Module condition:

#[cfg(feature = "axum-integration")]

axum::OpenAgentState

Shared state for the Axum integration.

#[cfg(feature = "axum-integration")]
#[derive(Clone)]
pub struct OpenAgentState<S: SessionStore + Clone + 'static = InMemorySessionStore> {
/// The server configuration (origin, realm, TTLs, trust tier).

pub config: Arc<ServerConfig>
}

Source line: 35.

axum::OpenAgentState<S>::new

Creates a new integration state.

#[cfg(feature = "axum-integration")]
pub fn new(config: ServerConfig, store: S) -> Self;

Source line: 43.

axum::OpenAgentState<S>::store

The session store.

#[cfg(feature = "axum-integration")]
pub fn store(&self) -> &S;

Source line: 51.

axum::OpenAgentExtractor

Axum extractor providing the authenticated agent context.

Routes can take this as an argument to get the verified session.

#[cfg(feature = "axum-integration")]
#[derive(Debug, Clone)]
pub struct OpenAgentExtractor {

}

Source line: 60.

axum::OpenAgentExtractor::peer_did

Returns the authenticated agent's DID (or presented-key placeholder until a resolver names it).

#[cfg(feature = "axum-integration")]
pub fn peer_did(&self) -> &str;

Source line: 67.

axum::OpenAgentExtractor::session_token

Returns the session token.

#[cfg(feature = "axum-integration")]
pub fn session_token(&self) -> &str;

Source line: 72.

axum::OpenAgentExtractor::session

Returns the underlying session.

#[cfg(feature = "axum-integration")]
pub fn session(&self) -> &Session;

Source line: 77.

axum::core_routes

Build an Axum router with the well-known endpoints:

  • GET /.well-known/openagent — discovery
  • POST /.well-known/openagent/auth — issue an [openagent_auth_protocol::message::IdentityChallenge]
  • POST /.well-known/openagent/auth/prove — verify an [IdentityProof], return [IdentityVerified]
#[cfg(feature = "axum-integration")]
pub fn core_routes<S>(state: OpenAgentState<S>) -> Router
where
    S: SessionStore + Clone + Send + Sync + 'static,;

Source line: 154.

axum::protected_router

Convenience: merge the well-known endpoints with application routes.

#[cfg(feature = "axum-integration")]
pub fn protected_router<S>(
    state: OpenAgentState<S>,
    app_routes: Router<OpenAgentState<S>>,
) -> Router
where
    S: SessionStore + Clone + Send + Sync + 'static,;

Source line: 207.

On this page