pub struct RemoteClient { /* private fields */ }Expand description
Remote client for connecting to a user-client through a proxy
Implementations§
Source§impl RemoteClient
impl RemoteClient
Sourcepub async fn new(
identity_provider: Box<dyn IdentityProvider>,
session_store: Box<dyn SessionStore>,
event_tx: Sender<RemoteClientEvent>,
response_rx: Receiver<RemoteClientResponse>,
proxy_client: Box<dyn ProxyClient>,
) -> Result<Self, RemoteClientError>
pub async fn new( identity_provider: Box<dyn IdentityProvider>, session_store: Box<dyn SessionStore>, event_tx: Sender<RemoteClientEvent>, response_rx: Receiver<RemoteClientResponse>, proxy_client: Box<dyn ProxyClient>, ) -> Result<Self, RemoteClientError>
Create a new remote client and connect to the proxy server
This establishes the WebSocket connection and authenticates with the proxy. After calling this, use one of the pairing methods:
pair_with_handshake()for new rendezvous-based pairingpair_with_psk()for PSK-based pairingload_cached_session()for reconnecting with a cached session
§Arguments
identity_provider- Provider for the client’s identitysession_store- Store for caching sessionsevent_tx- Channel sender for client eventsresponse_rx- Channel receiver for client responsesproxy_client- The proxy client implementation to use for communication
Sourcepub async fn pair_with_handshake(
&mut self,
rendezvous_code: &str,
verify_fingerprint: bool,
) -> Result<IdentityFingerprint, RemoteClientError>
pub async fn pair_with_handshake( &mut self, rendezvous_code: &str, verify_fingerprint: bool, ) -> Result<IdentityFingerprint, RemoteClientError>
Pair with a remote device using a rendezvous code
This resolves the rendezvous code to a fingerprint, performs the Noise handshake, and optionally waits for user fingerprint verification.
§Arguments
rendezvous_code- The rendezvous code to resolveverify_fingerprint- If true, emit fingerprint event and wait for user verification. If false, emit fingerprint event informationally and proceed immediately.
Sourcepub async fn pair_with_psk(
&mut self,
psk: Psk,
remote_fingerprint: IdentityFingerprint,
) -> Result<(), RemoteClientError>
pub async fn pair_with_psk( &mut self, psk: Psk, remote_fingerprint: IdentityFingerprint, ) -> Result<(), RemoteClientError>
Pair with a remote device using a pre-shared key
This uses the PSK for authentication, skipping fingerprint verification since trust is established through the PSK.
Sourcepub async fn load_cached_session(
&mut self,
remote_fingerprint: IdentityFingerprint,
) -> Result<(), RemoteClientError>
pub async fn load_cached_session( &mut self, remote_fingerprint: IdentityFingerprint, ) -> Result<(), RemoteClientError>
Reconnect to a remote device using a cached session
This verifies the session exists in the session store and reconnects without requiring fingerprint verification.
Sourcepub async fn request_credential(
&mut self,
query: &CredentialQuery,
) -> Result<CredentialData, RemoteClientError>
pub async fn request_credential( &mut self, query: &CredentialQuery, ) -> Result<CredentialData, RemoteClientError>
Request a credential over the secure channel
Sourcepub fn session_store(&self) -> &dyn SessionStore
pub fn session_store(&self) -> &dyn SessionStore
Get the session store for management operations
Sourcepub fn session_store_mut(&mut self) -> &mut dyn SessionStore
pub fn session_store_mut(&mut self) -> &mut dyn SessionStore
Get a mutable reference to the session store