openagent-client · crate
Declared module signatures, types, configuration, and source documentation.
Source: openagents/openagent.id/crates/openagent-client/src/lib.rs. SHA-256: 23b524b4bb88ff2889460df8f132972d7e3b707a7f3af5891a1f6d26c69240f4.
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.
error
pub mod error;Source line: 14.
::OpenAgentClient
An OpenAgent client that handles the challenge-response flow transparently.
Wraps an Ed25519 signing key. On each fetch, if the server returns 401,
the client automatically signs the challenge and retries.
Session tokens are cached and reused until they expire.
pub struct OpenAgentClient {
}Source line: 30.
::AuthenticatedResponse
Response from a successful OpenAgent-authenticated request.
#[derive(Debug)]
pub struct AuthenticatedResponse {
pub status: u16,
pub did: Option<String>,
pub trust_tier: Option<u8>,
pub session_token: Option<String>,
/// Legacy lineage response metadata retained only for migration and audit.
///
/// This value is never an authorization grant.
pub legacy_lineage_evidence: Option<serde_json::Value>,
pub body: Vec<u8>,
pub headers: reqwest::header::HeaderMap
}Source line: 43.
::OpenAgentClient::new
Creates a new client from a 32-byte Ed25519 secret key.
pub fn new(secret_key: &[u8; 32]) -> Self;Source line: 70.
::OpenAgentClient::public_key_bytes
Returns the Ed25519 public key as bytes.
pub fn public_key_bytes(&self) -> [u8; 32];Source line: 79.
::OpenAgentClient::fetch
Sends an authenticated request to the given URL.
The full flow:
- If a cached session token exists for this origin, try Bearer auth
- If no session or session is rejected (401), do challenge-response
- Cache the new session token
- Return the final response
pub async fn fetch(
&self,
url: &str,
body: Option<&[u8]>,
) -> Result<AuthenticatedResponse, ClientError>;Source line: 90.