Skip to main content

flare_core/common/
mod.rs

1//! Shared protocol, codec, error, and runtime support for `flare-core`.
2//!
3//! This module is the stable foundation used by both client and server builds.
4//! It intentionally contains transport-neutral building blocks:
5//!
6//! - [`protocol`] defines the public frame and command model.
7//! - [`message`] provides parsers, processors, middleware, and pipelines.
8//! - [`serializer`], [`compression`], and [`encryption`] provide pluggable wire
9//!   transformations.
10//! - [`error`] exposes typed errors and localized error construction.
11//! - [`config_types`] contains cross-cutting configuration such as heartbeat,
12//!   TLS, and transport selection.
13//! - [`features`] reports the capability set compiled into the current binary.
14//!
15//! Higher-level IM semantics should not be placed here. Keep this module
16//! focused on reusable transport and protocol primitives.
17
18#[cfg(not(target_arch = "wasm32"))]
19pub mod cert;
20pub mod compression;
21pub mod config_types;
22pub mod constants;
23pub mod conversation;
24pub mod device;
25pub mod encryption;
26pub mod error;
27pub mod features;
28pub mod message;
29pub mod message_observer;
30pub mod platform;
31pub mod protobuf_decoder;
32pub mod protocol;
33pub mod serializer;
34pub mod utils;
35
36// Commonly used types are re-exported here for ergonomic imports.
37
38pub use compression::{CompressionAlgorithm, CompressionUtil, Compressor};
39pub use config_types::{HeartbeatAppState, HeartbeatConfig, TlsConfig, TransportProtocol};
40pub use constants::*;
41pub use conversation::*;
42pub use device::{
43    DeviceConflictStrategy, DeviceConflictStrategyBuilder, DeviceInfo, DevicePlatform,
44};
45pub use encryption::{EncryptionAlgorithm, EncryptionUtil, Encryptor};
46pub use error::{ClientError, ErrorBuilder, ErrorCode, FlareError, Result, ServerError};
47pub use features::FeatureSet;
48pub use message::{
49    ArcMessageMiddleware, ArcMessageProcessor, DelegateProcessor, FunctionProcessor, LogLevel,
50    LoggingMiddleware, MessageContext, MessageEvent, MessageHandler, MessageMiddleware,
51    MessageParser, MessagePipeline, MessageProcessor, MetricsMiddleware, ValidationMiddleware,
52};
53pub use message_observer::{ArcMessageObserver, MessageObserver};
54pub use platform::{
55    AES256_KEY_LEN, MonotonicInstant, clear_runtime_encryption_key, default_local_ws_url,
56    format_now_rfc3339, has_runtime_encryption_key, interval, monotonic_now,
57    parse_encryption_key_hex, parse_encryption_key_utf8, register_aes256_encryption,
58    resolve_encryption_key_bytes, runtime_instance_id, set_runtime_encryption_key, sleep, timeout,
59    wall_clock_ms, web_device_info,
60};
61pub use protocol::{
62    Command, CustomCommand, Frame, NotificationCommand, PayloadCommand, Reliability,
63    SerializationFormat, SystemCommand,
64};
65pub use serializer::{SerializationUtil, Serializer};
66pub use utils::*;