Skip to main content

Module socket

Module socket 

Source
Expand description

Unix Socket IPC Utilities

Provides async read/write helpers for Unix domain socket communication between the TUI viewer and Agent process.

§Encryption

This module provides both plaintext and encrypted IPC:

  • IpcReader/IpcWriter - Plaintext JSON over newlines (legacy, for handshake)
  • EncryptedIpcReader/EncryptedIpcWriter - ChaCha20-Poly1305 encrypted messages

The encrypted variants use the session token to derive the encryption key, providing confidentiality and integrity for all messages after handshake.

Structs§

EncryptedIpcConnection
Encrypted IPC connection handle
EncryptedIpcReader
Encrypted reader for receiving IPC messages
EncryptedIpcWriter
Encrypted writer for sending IPC messages
IpcConnection
IPC connection handle (combines reader and writer)
IpcReader
Reader for receiving IPC messages
IpcWriter
Writer for sending IPC messages

Functions§

delete_session_token
Delete session token file
generate_session_token
Generate a cryptographically secure session token (64 hex characters = 256 bits)
get_agent_socket_path
Get the socket path for an agent session
get_session_token_path
Get the token file path for an agent session
read_session_token
Read session token from disk This is used by clients that need to reattach to a session
validate_session_token
Validate that a provided token matches the stored token for a session Returns true if tokens match, false if they don’t match or no token exists
write_session_token
Write session token to disk with secure permissions (0600) This should only be called by the agent process that owns the session