pub struct NoiseTransport { /* private fields */ }Expand description
Encrypted IPC transport wrapping a completed Noise session.
Provides chunked encrypted frame I/O over the Noise transport state.
Application frames are split into chunks of at most MAX_NOISE_PLAINTEXT
bytes, each encrypted as a separate Noise transport message.
The TransportState requires &mut self for both encrypt and decrypt,
so callers must coordinate access (e.g. via Arc<Mutex<NoiseTransport>>
when split into separate read/write tasks).
Implementations§
Source§impl NoiseTransport
impl NoiseTransport
Sourcepub async fn write_encrypted_frame<W: AsyncWrite + Unpin>(
&mut self,
writer: &mut W,
payload: &[u8],
) -> Result<()>
pub async fn write_encrypted_frame<W: AsyncWrite + Unpin>( &mut self, writer: &mut W, payload: &[u8], ) -> Result<()>
Write an encrypted application frame.
The payload is chunked into Noise transport messages of at most
MAX_NOISE_PLAINTEXT bytes each. Wire format per frame:
[4-byte BE chunk_count][chunk_1][chunk_2]...[chunk_n]Each chunk is written as a length-prefixed frame via write_frame.
§Errors
Returns an error on I/O failure or if the payload exceeds MAX_FRAME_SIZE.
Sourcepub async fn read_encrypted_frame<R: AsyncRead + Unpin>(
&mut self,
reader: &mut R,
) -> Result<Vec<u8>>
pub async fn read_encrypted_frame<R: AsyncRead + Unpin>( &mut self, reader: &mut R, ) -> Result<Vec<u8>>
Read and decrypt an application frame.
Reads the chunk count header, then reads and decrypts each chunk, reassembling the original plaintext payload.
§Errors
Returns an error on I/O failure, decryption failure, or if the
reassembled payload exceeds MAX_FRAME_SIZE.
Sourcepub fn is_initiator(&self) -> bool
pub fn is_initiator(&self) -> bool
Check if this transport was created by the initiator side.
Sourcepub fn remote_static(&self) -> Option<&[u8]>
pub fn remote_static(&self) -> Option<&[u8]>
Get the remote party’s static public key.