openagent-server · layer
Declared module signatures, types, configuration, and source documentation.
Source: openagents/openagent.id/crates/openagent-server/src/layer.rs. SHA-256: d3ed7de38e820ff9f645b974e5fb314d02837d9b4b7c79ffd1e6f1e9851dc0d3.
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.
layer::OpenAgentState
Shared state for the OpenAgent middleware.
pub struct OpenAgentState {
pub config: OpenAgentConfig,
pub nonce_store: NonceStore,
pub l1feid_client: L1feIdClient,
pub authority_verifier: Arc<dyn PrivilegedAuthorityVerifier>
}Source line: 30.
layer::OpenAgentLayer
The Axum middleware layer.
Attach to a router:
use openagent_server::{OpenAgentConfig, OpenAgentLayer};
let config = OpenAgentConfig::new("https://api.example.com", b"my-secret-key-32-bytes-minimum!!");
let app = Router::new()
.route("/api/data", get(handler))
.layer(OpenAgentLayer::new(config));#[derive(Clone)]
pub struct OpenAgentLayer {
}Source line: 49.
layer::OpenAgentLayer::new
Creates a new layer with the L1feID client resolved via
[crate::l1feid_client::L1feIdClient::from_env]
(LIFEID_SERVICE_URL / L1FEID_API_URL contract).
pub fn new(config: OpenAgentConfig) -> Self;Source line: 57.
layer::OpenAgentLayer::with_l1feid_client
Creates a new layer with an explicit L1feID client (useful for testing).
pub fn with_l1feid_client(config: OpenAgentConfig, l1feid_client: L1feIdClient) -> Self;Source line: 71.
layer::OpenAgentLayer::with_authority_verifier
Creates a new layer with an explicit privileged authority verifier.
pub fn with_authority_verifier(
config: OpenAgentConfig,
authority_verifier: Arc<dyn PrivilegedAuthorityVerifier>,
) -> Self;Source line: 84.
layer::OpenAgentLayer::with_l1feid_and_authority_verifier
Creates a new layer with explicit L1feID and privileged authority clients.
pub fn with_l1feid_and_authority_verifier(
config: OpenAgentConfig,
l1feid_client: L1feIdClient,
authority_verifier: Arc<dyn PrivilegedAuthorityVerifier>,
) -> Self;Source line: 101.
layer::OpenAgentMiddleware
The middleware service that wraps the inner handler.
#[derive(Clone)]
pub struct OpenAgentMiddleware<S> {
}Source line: 131.