pub trait PairingRelayClient: Send + Sync {
// Required methods
fn create_session(
&self,
registry_url: &str,
request: &CreateSessionRequest,
) -> impl Future<Output = Result<CreateSessionResponse, NetworkError>> + Send;
fn get_session(
&self,
registry_url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send;
fn lookup_by_code(
&self,
registry_url: &str,
code: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send;
fn submit_response(
&self,
registry_url: &str,
session_id: &str,
response: &SubmitResponseRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send;
fn wait_for_update(
&self,
registry_url: &str,
session_id: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<GetSessionResponse>, NetworkError>> + Send;
fn submit_confirmation(
&self,
url: &str,
session_id: &str,
request: &SubmitConfirmationRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send;
fn get_confirmation(
&self,
url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetConfirmationResponse, NetworkError>> + Send;
}Expand description
Port trait for communicating with a pairing relay server.
Implementations handle transport details (HTTP, WebSocket, etc.). SDK orchestrators depend only on this abstraction.
Usage:
use auths_core::ports::pairing::PairingRelayClient;
async fn run(relay: &impl PairingRelayClient, registry: &str) {
let resp = relay.create_session(registry, &request).await?;
}Required Methods§
Sourcefn create_session(
&self,
registry_url: &str,
request: &CreateSessionRequest,
) -> impl Future<Output = Result<CreateSessionResponse, NetworkError>> + Send
fn create_session( &self, registry_url: &str, request: &CreateSessionRequest, ) -> impl Future<Output = Result<CreateSessionResponse, NetworkError>> + Send
Creates a new pairing session on the relay server.
Args:
registry_url: Base URL of the pairing relay server.request: Session creation parameters including controller DID and capabilities.
Usage:
let resp = relay.create_session("https://registry.example.com", &request).await?;Sourcefn get_session(
&self,
registry_url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send
fn get_session( &self, registry_url: &str, session_id: &str, ) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send
Fetches the current state of a pairing session.
Args:
registry_url: Base URL of the pairing relay server.session_id: The session identifier returned bycreate_session.
Usage:
let session = relay.get_session("https://registry.example.com", &session_id).await?;Sourcefn lookup_by_code(
&self,
registry_url: &str,
code: &str,
) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send
fn lookup_by_code( &self, registry_url: &str, code: &str, ) -> impl Future<Output = Result<GetSessionResponse, NetworkError>> + Send
Looks up a session by its short human-readable code.
Args:
registry_url: Base URL of the pairing relay server.code: The normalised short code (e.g."abc123").
Usage:
let session = relay.lookup_by_code("https://registry.example.com", "abc123").await?;Sourcefn submit_response(
&self,
registry_url: &str,
session_id: &str,
response: &SubmitResponseRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send
fn submit_response( &self, registry_url: &str, session_id: &str, response: &SubmitResponseRequest, ) -> impl Future<Output = Result<(), NetworkError>> + Send
Submits a device pairing response to a session.
Args:
registry_url: Base URL of the pairing relay server.session_id: The session to respond to.response: The pairing response payload (device keys, DID, signature).
Usage:
relay.submit_response("https://registry.example.com", &session_id, &response).await?;Sourcefn wait_for_update(
&self,
registry_url: &str,
session_id: &str,
timeout: Duration,
) -> impl Future<Output = Result<Option<GetSessionResponse>, NetworkError>> + Send
fn wait_for_update( &self, registry_url: &str, session_id: &str, timeout: Duration, ) -> impl Future<Output = Result<Option<GetSessionResponse>, NetworkError>> + Send
Waits for a session to reach a terminal state, using WebSocket with HTTP polling fallback.
Returns None if timeout elapses before any terminal state is reached.
Args:
registry_url: Base URL of the pairing relay server.session_id: The session to watch.timeout: Maximum time to wait before returningNone.
Usage:
let result = relay.wait_for_update(registry, &session_id, Duration::from_secs(60)).await?;Sourcefn submit_confirmation(
&self,
url: &str,
session_id: &str,
request: &SubmitConfirmationRequest,
) -> impl Future<Output = Result<(), NetworkError>> + Send
fn submit_confirmation( &self, url: &str, session_id: &str, request: &SubmitConfirmationRequest, ) -> impl Future<Output = Result<(), NetworkError>> + Send
Submits a SAS confirmation (encrypted attestation or abort signal).
Args:
url: Base URL of the pairing server.session_id: The session to confirm.request: The confirmation payload.
Sourcefn get_confirmation(
&self,
url: &str,
session_id: &str,
) -> impl Future<Output = Result<GetConfirmationResponse, NetworkError>> + Send
fn get_confirmation( &self, url: &str, session_id: &str, ) -> impl Future<Output = Result<GetConfirmationResponse, NetworkError>> + Send
Polls for a SAS confirmation from the initiator.
Args:
url: Base URL of the pairing server.session_id: The session to check.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.