pub struct PairingManager {
pub agent_id: String,
/* private fields */
}Expand description
Manages one-time pairing codes for secure client registration
Fields§
§agent_id: StringStable agent identity included in every pairing response.
Implementations§
Source§impl PairingManager
impl PairingManager
Sourcepub fn new_with_cf(
agent_id: String,
websocket_url: String,
auth_token: String,
cert_fingerprint: Option<String>,
client_id: Option<String>,
client_secret: Option<String>,
cwd: String,
) -> Self
pub fn new_with_cf( agent_id: String, websocket_url: String, auth_token: String, cert_fingerprint: Option<String>, client_id: Option<String>, client_secret: Option<String>, cwd: String, ) -> Self
Create a new PairingManager including Cloudflare service token credentials.
agent_id is a stable UUID that will be included in the pairing response
so mobile clients can deduplicate connections across transports.
Sourcepub fn with_tailscale_path(self) -> Self
pub fn with_tailscale_path(self) -> Self
Mark this manager as using Tailscale transport (emits /pair/tailscale in QR URL)
Sourcepub fn with_relay_url(self, url: String) -> Self
pub fn with_relay_url(self, url: String) -> Self
Set the push relay URL to include in the pairing response. Only set when push is fully configured (url + client_id both non-empty).
Sourcepub fn get_pairing_url(&self, base_url: &str) -> String
pub fn get_pairing_url(&self, base_url: &str) -> String
Get the pairing URL (for QR code)
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the code has expired
Sourcepub fn seconds_remaining(&self) -> u64
pub fn seconds_remaining(&self) -> u64
Get remaining seconds until expiration
Sourcepub fn validate(&self, code: &str) -> Result<PairingResponse, PairingError>
pub fn validate(&self, code: &str) -> Result<PairingResponse, PairingError>
Validate a pairing code and return connection details if valid
Sourcepub fn get_cert_fingerprint(&self) -> Option<&str>
pub fn get_cert_fingerprint(&self) -> Option<&str>
Get the certificate fingerprint (if available)
Auto Trait Implementations§
impl !Freeze for PairingManager
impl RefUnwindSafe for PairingManager
impl Send for PairingManager
impl Sync for PairingManager
impl Unpin for PairingManager
impl UnsafeUnpin for PairingManager
impl UnwindSafe for PairingManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more