pub struct EncryptedLinkHandshake { /* private fields */ }Expand description
Handle to an in-progress Noise handshake.
Created by initiate_encrypted_link (initiator) or
accept_encrypted_link (responder). Drive the handshake forward by
repeatedly calling advance_handshake until it returns
HandshakeProgress::Complete.
The caller owns polling, timeouts, and backoff. Homeserver write failures are
automatically recovered up to
DEFAULT_MAX_RECOVERY_ATTEMPTS unless overridden.
Implementations§
Source§impl EncryptedLinkHandshake
impl EncryptedLinkHandshake
Sourcepub async fn prepare_next_step(
self,
) -> Result<Option<PreparedEncryptedLinkHandshakeStep>>
pub async fn prepare_next_step( self, ) -> Result<Option<PreparedEncryptedLinkHandshakeStep>>
Fetch at most one bounded packet and prepare one existing Noise step.
Returns None only for an absent required packet (404/410). No publication
occurs. The caller must validate the source checkpoint before applying
either the result or an error, and persist pending output before sending.
Session authorization, capability scope, and rotation are caller-owned.
Sourcepub fn finish_if_complete(self) -> Result<HandshakeProgress>
pub fn finish_if_complete(self) -> Result<HandshakeProgress>
Complete a restored handshake without any reads or writes. An incomplete handshake is returned unchanged. Restore only an acknowledged checkpoint; authorization and key rotation are caller-owned.
Sourcepub fn remote_static_public_key(&self) -> Option<&[u8]>
pub fn remote_static_public_key(&self) -> Option<&[u8]>
X25519 static key authenticated by the completed Noise handshake.
Returns None while the handshake is incomplete.
The caller must authenticate this key before trusting the completed link.
Sourcepub fn set_max_recovery_attempts(&mut self, max: u32) -> &mut Self
pub fn set_max_recovery_attempts(&mut self, max: u32) -> &mut Self
Set the maximum number of consecutive automatic recovery attempts
before advance_handshake gives up and returns
an error whose underlying cause is PaykitError::Transport.
Default: DEFAULT_MAX_RECOVERY_ATTEMPTS (3).
Sourcepub fn snapshot(&self) -> Result<EncryptedLinkHandshakeSnapshot>
pub fn snapshot(&self) -> Result<EncryptedLinkHandshakeSnapshot>
Capture the current handshake state as a serializable snapshot.
Snapshot bytes include sensitive key material and must be stored as secrets.
Sourcepub fn serialize(&self) -> Result<Vec<u8>>
pub fn serialize(&self) -> Result<Vec<u8>>
Serialize the current handshake state to bytes for persistence.
Convenience method equivalent to self.snapshot()?.serialize().
Sourcepub fn config(&self) -> &Arc<PubkyNoiseConfig> ⓘ
pub fn config(&self) -> &Arc<PubkyNoiseConfig> ⓘ
Access the shared Noise configuration for this handshake.
Useful for passing to restore_encrypted_link_handshake_from_config
when performing in-process recovery without an app restart.