Skip to main content

sentinelpass_protocol/
lib.rs

1//! SentinelPass IPC protocol contract.
2//!
3//! This crate is the narrow, stable surface that daemon clients embed:
4//! message types, the authentication envelope, wire framing (length-prefixed
5//! frames, 64 KiB cap), platform transports (client side), token file
6//! management, and [`IpcClient`].
7//!
8//! Stability rules:
9//! - Every wire type must deserialize old payloads (serde defaults for new
10//!   fields; unknown fields are ignored by serde).
11//! - Framing and Windows AES-256-GCM frame format never change byte layout.
12//!
13//! Server-side types (listeners, the request dispatcher) intentionally live
14//! in `sentinelpass-core`, not here.
15
16pub mod client;
17pub mod envelope;
18pub mod error;
19pub mod message;
20pub mod paths;
21pub mod token;
22pub mod transport;
23#[cfg(windows)]
24pub mod windows_frame;
25
26pub use client::IpcClient;
27pub use envelope::{IpcEnvelope, Origin};
28pub use error::ProtocolError;
29pub use message::{CredentialSummary, ExternalSecretField, IpcMessage};
30pub use paths::{default_ipc_socket_path, default_ipc_token_path, get_config_dir};
31pub use token::{load_ipc_token, load_or_create_ipc_token};
32#[cfg(unix)]
33pub use transport::unix::UnixSocketConnection;
34#[cfg(windows)]
35pub use transport::windows::WindowsNamedPipeConnection;
36pub use transport::{TransportConfig, TransportError, TransportResult, MAX_MESSAGE_SIZE};
37#[cfg(windows)]
38pub use windows_frame::{
39    decrypt_windows_ipc_frame, encrypt_windows_ipc_frame, windows_named_pipe_path,
40};
41
42pub type Result<T> = std::result::Result<T, ProtocolError>;