Protocol Spec: SIAR Wire v1.0 (Postcard 1.0)
C-ABI Header: include/siar_core.h (C99 / C++20)
Crypto Standard: RFC 9420 (OpenMLS) + RFC 8032 (Ed25519)
Daemon IPC: Unix Domain Socket /var/run/siar/
SDK Coverage: Rust, Kotlin, C++, Python, TS, Go
ENGINEERING SPECIFICATIONS & SDK HUB

SIAR Protocol Documentation & Developer Hub

Comprehensive architectural references, Postcard binary framing rules, C-ABI foreign function headers, multi-language client libraries, OpenMLS interactive studio, and official test vectors.

CHAPTER 01

Architecture & Threat Model Overview

SIAR (Survivable Identity & Autonomous Routing) is engineered as a zero-infrastructure, censorship-resistant mesh communication platform. The protocol assumes complete adversarial control over intermediate network links, Anycast edge CDN nodes, and local Internet Service Providers.

Zero Central Infrastructure

No DNS lookups, CA authorities, or centralized registration servers required.

Delay-Tolerant (DTN)

RFC 9171 Store-Carry-Forward bundle routing traverses physical air-gaps.

Post-Compromise Security

OpenMLS Tree-KEM ratchet ensures past keys cannot decrypt future messages.

CHAPTER 02

Postcard Binary Wire Framing Specification

SIAR utilizes Postcard 1.0 zero-copy binary serialization for all radio broadcasts and packet streams. All integers are encoded as little-endian variable-length integers (varints) or fixed-width arrays.

/// Canonical SIAR Wire Envelope Header Structure
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WireHeader {
    pub magic: [u8; 4],             // Magic bytes: b"SIAR" (0x53, 0x49, 0x41, 0x52)
    pub protocol_version: u16,      // Current: 1 (0x01, 0x00)
    pub frame_type: FrameType,      // Handshake=1, RouteDiscovery=2, DataBundle=3, Ack=4, Emergency=15
    pub flags: u8,                  // Bit 0: Encrypted, Bit 1: DTN Forwardable, Bit 2: SOS
    pub source_id: [u8; 32],        // Ed25519 Public Key
    pub destination_id: [u8; 32],   // Ed25519 Public Key
    pub sequence_number: u64,       // Monotonic sequence number
    pub timestamp_ms: u64,          // Epoch timestamp in milliseconds
    pub payload_len: u32,           // Length of succeeding payload buffer
}

⚡ Interactive Postcard Wire Frame Builder

92 bytes (Postcard Envelope)
Raw Serialized Hex Stream:

              
Decoded Rust AST:

              
CHAPTER 03

Pure-Rust Core Crates Architecture

The SIAR node engine is decoupled into modular, standalone Rust crates designed to compile to native targets and `wasm32-unknown-unknown`:

siar-crypto RFC 9420 + RFC 8032

Self-sovereign Ed25519 & X25519 identities, QR Peer Tickets, and Tree-KEM logarithmic group ratchet with Post-Compromise Security (PCS).

// Cargo.toml: siar-crypto = { git = "https://github.com/irshadali5/siar" }
use siar_crypto::{DeviceIdentity, PublicIdentity, PeerTicket, MlsGroupState, PairwiseChannelEngine};
use rand_core::OsRng;

// 1. Generate Sovereign Identity Keypair (auto-zeroized on drop)
let (alice_dev, alice_pub) = DeviceIdentity::generate(&mut OsRng, "Alice".into(), 1700000000000);
println!("Sovereign Address: {}", alice_pub.address()); // e.g. siar17a4fb918cc3da10e

// 2. Create and verify Out-of-Band Peer Ticket (for QR/NFC handshake)
let ticket = PeerTicket::create(&alice_dev, transport_flags::BLE_5_EXTENDED, node_capability_flags::STORE_CARRY_FORWARD_ROUTER, 0);
let qr_string = ticket.to_qr_string()?; // "siar:ticket:..."

// 3. Encrypt 1-to-1 Asynchronous Direct Message (ChaCha20-Poly1305 + X25519 ECDH)
let envelope = PairwiseChannelEngine::encrypt_message(&mut OsRng, &alice_dev, &bob_pub, b"Secret Payload")?;
siar-transport BLE 5.x / Wi-Fi / LoRa / QUIC

Async physical radio driver abstractions, BLE L2CAP MTU slicer, LoRa SX1262 framing, and battery-aware ETX scheduler.

// Cargo.toml: siar-transport = { git = "https://github.com/irshadali5/siar" }
use siar_transport::{TransportOrchestrator, BleTransport, WifiDirectTransport, LoraTransport, LoraConfig};

let mut orchestrator = TransportOrchestrator::new();
orchestrator.register_transport(Box::new(BleTransport::new(local_peer_id)));
orchestrator.register_transport(Box::new(WifiDirectTransport::new(local_peer_id, false)));
orchestrator.register_transport(Box::new(LoraTransport::new(local_peer_id, LoraConfig::sx1262_us915())));

// Dynamically routes over fastest link or lowest ETX based on battery %
orchestrator.set_battery_percent(85.0);
orchestrator.route_and_send(&recipient_peer_id, &payload_bytes).await?;
siar-dtn RFC 9171 DTN

PRoPHET probabilistic routing, 256-byte Bloom filter anti-entropy sync, and flash storage queue with SOS alert immortality.

// Cargo.toml: siar-dtn = { git = "https://github.com/irshadali5/siar" }
use siar_dtn::{DtnBundle, bundle_flags, ProphetRouter, DtnStorageEngine, InventoryBloomFilter};

// Create a DTN bundle with 72-hour lifetime and SOS priority
let bundle = DtnBundle::new(source_id, dest_id, payload, bundle_flags::PRIORITY_EMERGENCY_SOS, 259_200_000, now_ms);

// Manage persistent storage quota (evicts low-priority bundles, preserves SOS alerts)
let mut storage = DtnStorageEngine::new(500 * 1024 * 1024); // 500 MB quota
storage.store_bundle(bundle, now_ms)?;
siar-security Zero-Trust & Anti-Sybil

Dynamic BLAKE3 Proof-of-Work anti-Sybil puzzle engine, quantized traffic padding (256B/512B/1024B), and multi-pass RAM shredder.

// Cargo.toml: siar-security = { git = "https://github.com/irshadali5/siar" }
use siar_security::{ProofOfWorkEngine, TrafficObfuscator, AntiForensicsEngine};

// 1. Solve Proof-of-Work puzzle to authenticate ephemeral relay request
let token = ProofOfWorkEngine::mine_token(&source_pubkey, epoch_hour, 12);
assert!(ProofOfWorkEngine::verify_token(&source_pubkey, &token, epoch_hour));

// 2. Pad frame to standard bucket boundary with random chaff to defeat traffic analysis
let padded_frame = TrafficObfuscator::pad_to_bucket(&mut OsRng, &plaintext_message);
siar-telemetry Prometheus & Differential Privacy

Zero-PII Prometheus metrics collection, differential privacy Laplace noise mechanism, and multi-hop DTN trace profiler.

// Cargo.toml: siar-telemetry = { git = "https://github.com/irshadali5/siar" }
use siar_telemetry::{MeshMetricsRegistry, DifferentialPrivacyEngine, DtnDiagnosticTrace};

let registry = MeshMetricsRegistry::new();
registry.active_ble_neighbors.fetch_add(1, Ordering::Relaxed);
let prom_text = registry.render_prometheus_text(); // Standard Prometheus /metrics format
CHAPTER 04

C-ABI Foreign Function Interface (FFI)

For embedded microcontrollers, C/C++ daemons, and foreign runtime languages, SIAR provides a thread-safe, panic-free C-ABI exported in include/siar_core.h.

// C-ABI Function Signatures (include/siar_core.h)
int32_t siar_node_init(const char* storage_path, SiarNodeHandle** out_handle);
int32_t siar_node_send_message(
    SiarNodeHandle* handle,
    const uint8_t* destination_pubkey_32,
    const uint8_t* payload_bytes,
    uint32_t payload_len,
    uint32_t priority_class
);
void siar_node_destroy(SiarNodeHandle* handle);
CHAPTER 05

Multi-Language SDK Explorer

Select your preferred programming language to view end-to-end code integration examples:

// Cargo.toml: siar = "0.1.0", tokio = { version = "1", features = ["full"] }
use siar::prelude::*;

#[tokio::main]
async fn main() -> Result<(), SiarError> {
    let config = SiarConfig::builder()
        .storage_dir("~/.local/share/siar")
        .enable_ble_mesh(true)
        .enable_wifi_direct(true)
        .build();

    let node = SiarNode::init(config).await?;
    println!("Node Sovereign Address: {}", node.public_identity().address());

    Ok(())
}
CHAPTER 06

Headless Daemon JSON-RPC & IPC

Headless repeaters and solar nodes expose an asynchronous JSON-RPC 2.0 interface over Unix Domain Socket /var/run/siar/node.sock.

JSON-RPC 2.0 Request Payload:
{
  "jsonrpc": "2.0",
  "method": "siar_get_node_info",
  "params": {},
  "id": 1
}
Simulated Daemon Response:
{
  "jsonrpc": "2.0",
  "result": {
    "node_id": "siar17a4fb918cc3da10e",
    "alias": "SIAR-Emergency-Repeater",
    "uptime_seconds": 84120,
    "active_neighbors": 14,
    "dtn_queue_bundles": 18,
    "storage_used_bytes": 4194304
  },
  "id": 1
}
CHAPTER 07 (PART XI)

Cryptographic Identity & OpenMLS Studio

Test sovereign Ed25519 identity generation, generate Out-of-Band QR Peer Tickets, and step through OpenMLS (RFC 9420) Tree-KEM group ratchets directly in your browser:

Derived BLAKE3 Sovereign Address:
siar17a4fb918cc3da10e
Out-of-Band Peer Ticket QR Payload:
siar:ticket:eyJtYWdpYyI6IlNJQVIiLCJ2ZXJzaW9uIjoxLCJhbGlhcyI6Ik1lZGljLUFscGhhIiwiYWRkcmVzcyI6InNpYXIxN2E0ZmI5MTgiLCJ0cmFuc3BvcnRzIjpbIkJMRV81X0V4dGVuZGVkIiwiV2lGaV9EaXJlY3RfUDJQIl0sImNhcGFiaWxpdGllcyI6WyJEVE5fU3RvcmVDYXJyeUZvcndhcmQiLCJFbWVyZ2VuY3lfU09TIl19
OpenMLS (RFC 9420) Group Ratchet State:
Active Epoch: 1 | Tree-KEM Root Secret: e3b0c44298fc1c14... (Forward Secrecy Enforced)
CHAPTER 08 (PART XII)

Multi-Transport & ETX / Airtime Engine

Simulate dynamic Expected Transmission Count (ETX) and LoRa SX1262 Time-on-Air (ToA) airtime compliance:

ETX: 1.074 🟢 Viable Link
Time-on-Air: 78 ms | ETSI 1% Hourly Quota: 461 bursts/hour
CHAPTER 09 (PART XV)

Anti-Sybil Proof-of-Work Challenge Playground

Enforce computational cost on unauthenticated peers to choke spam floods and prevent Sybil node denial-of-service attacks:

Ready to solve challenge puzzle.
CHAPTER 10 (PART XVI)

Zero-PII Prometheus Metrics Exporter

Live simulated Prometheus exposition endpoint exported on http://127.0.0.1:9443/metrics:


            
CHAPTER 11

Official Protocol & Cryptographic Test Vectors

Download canonical, versioned JSON test vectors to validate third-party implementations against official SIAR protocol standards:

Postcard Wire Framing

Byte-level encoding, magic headers, and varint tests.

📥 postcard_wire_framing.json

OpenMLS Tree-KEM Ratchet

Multi-party state transitions and transcript hashes.

📥 crypto_mls_group_ratchet.json

DTN PRoPHET Routing

Encounter updates, decay aging, and transitivity.

📥 dtn_prophet_routing.json

Anti-Sybil PoW Challenges

BLAKE3 difficulty puzzles and nonce validation.

📥 threat_pow_challenge.json

Multi-Transport ETX & Airtime

Link quality estimation and ETSI 1% LoRa airtime.

📥 transport_etx_metrics.json

Ed25519 Identity Signatures

RFC 8032 signature generation & verification vectors.

📥 crypto_ed25519_sign_verify.json