openagent-weave · protocol
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/adapters/weave/src/protocol.rs. SHA-256: bd8735b2415d92f289459b6292df66aa1501a366a3ea8309a654f9093b07a8bd.
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.
protocol::OPENAGENT_AUTH_PROTOCOL
The protocol identifier for OpenAgent auth on libp2p.
pub const OPENAGENT_AUTH_PROTOCOL: &str;Source line: 21.
protocol::HandshakeRequest
A handshake request (sent by the initiator).
Maps to Steps 1 (PRESENT) and 3 (PROVE) of the OAAP handshake.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum HandshakeRequest {
/// Step 1: Initiator presents identity.
Present(PresentMessage),
/// Step 3: Initiator proves ownership of the DID private key.
Prove(ProveMessage),
}Source line: 31.
protocol::HandshakeResponse
A handshake response (sent by the responder).
Maps to Steps 2 (CHALLENGE) and 4 (ESTABLISHED) of the OAAP handshake.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum HandshakeResponse {
/// Step 2: Responder issues a challenge.
Challenge(ChallengeMessage),
/// Step 4: Authentication established.
Established(EstablishedMessage),
/// Error during handshake — the responder rejected the request.
Error {
/// Machine-readable error code.
code: String,
/// Human-readable reason.
reason: String,
},
}Source line: 42.
protocol::WeaveAuthEvent
Events emitted by [WeaveAuthBehaviour].
pub type WeaveAuthEvent = request_response::Event<HandshakeRequest, HandshakeResponse>;Source line: 61.
protocol::WeaveAuthBehaviour
libp2p NetworkBehaviour for the OpenAgent auth protocol.
This is a thin wrapper around request_response::Behaviour configured with
the CBOR codec and the /openagent/auth/1.0.0 protocol. Compose it into
your swarm alongside other behaviours (Kademlia, Identify, etc.).
Example
use openagent_weave::{WeaveAuthBehaviour, WeaveAuthConfig};
let config = WeaveAuthConfig::default();
let auth_behaviour = WeaveAuthBehaviour::new(config);
// Include `auth_behaviour` in your composed NetworkBehaviour struct.pub type WeaveAuthBehaviour = request_response::Behaviour<CborCodec>;Source line: 78.
protocol::new_behaviour
Create a new [WeaveAuthBehaviour] with the given configuration.
Both inbound and outbound support is enabled so the node can both initiate and accept handshakes.
pub fn new_behaviour(config: &WeaveAuthConfig) -> WeaveAuthBehaviour;Source line: 84.
protocol::send_request
Send a handshake request to a specific peer.
Returns the OutboundRequestId for correlating the response.
pub fn send_request(
behaviour: &mut WeaveAuthBehaviour,
peer: &PeerId,
request: HandshakeRequest,
) -> request_response::OutboundRequestId;Source line: 100.
protocol::send_response
Send a handshake response for an inbound request.
channel comes from the request_response::Event::Message::Request variant.
pub fn send_response(
behaviour: &mut WeaveAuthBehaviour,
channel: request_response::ResponseChannel<HandshakeResponse>,
response: HandshakeResponse,
) -> Result<(), HandshakeResponse>;Source line: 111.