Orbit PlatformStorage Architecture & Offline ResilienceIntermediate

Orbit Desktop Offline WAL Outbox, AES-256-GCM Payload Encryption & Replay Resilience

Exhaustive disaster recovery manual and systems engineering specification for Orbit Desktop embedded WAL outbox, machine-derived AES-256-GCM transaction encryption, random 12-byte nonce isolation, and conflict-free network replay.

·
8 min read

1. Disaster Recovery & Zero-Data-Loss Architecture

Point-of-sale workstations and field kiosks operate under unpredictable network conditions:

  • Metropolitan Fiber Cuts: Extended physical ISP outages lasting several hours.
  • Local Wi-Fi Channel Saturation: High client density during peak rush hours causing transient packet drops.
  • Counter Power Interruption: Abrupt power disconnection while local transactions are being committed to disk.

To maintain operations under these conditions, Orbit Desktop employs an encrypted local outbox pattern implemented in apps/desktop/crates/orbit-desktop-core/src/storage/encrypted_outbox.rs:

[Retail / Clinical / School Transaction]
                   |
                   v
    [AES-256-GCM Cryptographic Seal]
     - Machine-Derived Key (Hardware Hash + Salt)
     - Fresh 12-Byte Random Nonce per Entry
                   |
                   v
   [Local Embedded Transactional Outbox (WAL Mode)]
     - Immediate Disk Flush (< 5 ms)
     - Thermal Receipt Printed / Action Confirmed
                   |
       (Network Restored Event)
                   |
                   v
     [Transactional Outbox Replay Worker]
     - Deterministic Chronological Batch Drain
     - Server Idempotency Key De-duplication
     - Automatic 409 Conflict Quarantine

2. Interactive Offline Outbox Console

Store supervisors and systems engineers monitor pending queue depth, cryptographic integrity, and synchronization progress through the desktop outbox monitor:

Orbit Desktop Offline Outbox & Sync Sentinel
Production UI
Encrypted Embedded WAL Store, Queue Telemetry & Replay ControllerOffline Encrypted Outbox Monitor
Storage Mode
EMBEDDED WAL
orbit_offline.db (Active)
busy_timeout: 5,000 ms
Encryption Standard
AES-256-GCM
Hardware Node Bound Key
12-Byte Nonce Isolation
Pending Outbox Queue
0 RECORDS
All Transactions Synced
Queue Latency: 0 ms
Quarantine Vault
0 CONFLICTS
Zero Rejected Entries
409 Exceptions: None
Encrypted Binary Record Structure (Disk Preview)
PRAGMA journal_mode = WAL
// Embedded Row Inspection (offline_outbox table)
id: 1042
tenant_id: "e7a3b4c1-289d-4a11-8c43-98f5a2b10091"
action: "COMMERCE_ORDER_CHECKOUT"
encrypted_payload: <BLOB: 12-byte nonce (7e3a...) + ciphertext (f981b2...) + 16-byte GCM tag>
created_at: 1775739600 · synced: 1

3. Machine-Bound Key Derivation & AES-256-GCM Encryption

To prevent an adversary from reading the embedded database file by extracting the physical hard drive or copying orbit_offline.db to an unauthorized computer, the encryption key is bound to the local hardware.

3.1 Hardware-Derived Encryption Key

The storage key is computed dynamically at runtime using derive_storage_key() in encrypted_outbox.rs:

fn derive_storage_key() -> [u8; 32] {
    let fp = generate_hardware_fingerprint();
    let mut hasher = Sha256::new();
    hasher.update(b"ORBIT_OFFLINE_STORAGE_KEY_DERIVATION_V2_2026");
    hasher.update(fp.as_bytes());
    let result = hasher.finalize();
    let mut key = [0u8; 32];
    key.copy_from_slice(&result);
    key
}

Because the hardware fingerprint aggregates the machine GUID, CPU architecture, core topology, and static salt, the resulting 256-bit encryption key cannot decrypt the database file on any other physical workstation.

3.2 Authenticated Encryption with Nonce-Prepended Storage

When enqueue() is called, the outbox engine generates a fresh 12-byte random cryptographic nonce using the operating system entropy source (OsRng). This guarantees that even identical transactions produce distinct ciphertexts:

let key = derive_storage_key();
let cipher = Aes256Gcm::new_from_slice(&key).map_err(|e| e.to_string())?;
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
let ciphertext = cipher
    .encrypt(&nonce, payload_json.as_bytes())
    .map_err(|e| e.to_string())?;

// Prepend 12-byte random nonce to ciphertext for per-entry nonce uniqueness
let mut encrypted = Vec::with_capacity(12 + ciphertext.len());
encrypted.extend_from_slice(&nonce);
encrypted.extend_from_slice(&ciphertext);

The 12-byte nonce is prepended directly to the ciphertext blob in the embedded database. When reading the record during replay, dequeue_unsynced() extracts the first 12 bytes as the nonce and passes the remaining bytes to Aes256Gcm::decrypt().


4. Embedded WAL Mode & Concurrency Architecture

Point-of-sale checkout counters require sub-millisecond database commit latency. Writing synchronously to a standard disk file can cause lockups if multiple threads write simultaneously.

Orbit Desktop configures high-concurrency PRAGMAs during database initialization:

PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA busy_timeout = 5000;

4.1 Parameter Mechanics

  • PRAGMA journal_mode = WAL: Enables Write-Ahead Logging. Readers never block writers, and writers never block readers. Transactions append sequentially to orbit_offline.db-wal without locking the main database file.
  • PRAGMA synchronous = NORMAL: Eliminates redundant disk sync operations on modern file systems while preserving data safety across power cuts.
  • PRAGMA busy_timeout = 5000: Ensures that if another process or thread briefly accesses the outbox, concurrent write calls wait up to 5,000 milliseconds rather than failing with an immediate SQL busy error.

4.2 Table Schema & Index Design

The relational schema provides chronological FIFO queuing:

CREATE TABLE IF NOT EXISTS offline_outbox (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    tenant_id TEXT NOT NULL,
    action TEXT NOT NULL,
    encrypted_payload BLOB NOT NULL,
    created_at INTEGER NOT NULL,
    synced INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS idx_outbox_synced ON offline_outbox(synced, created_at);

The composite index on (synced, created_at) allows the replay daemon to fetch unsynced records in chronological order with zero table-scan overhead.


5. Network Recovery & Conflict Quarantine Replay Pipeline

When connectivity to the central application server is restored, the desktop runtime initiates the automated outbox drainage pipeline:

Offline Outbox Drainage & Conflict Quarantine Pipeline
NETWORK RESTOREDEvent Listener TriggerHeartbeat OKDEQUEUE BATCHAES-256-GCM DecryptedChronological OrderSERVER DISPATCHIdempotent Sync IngestHTTP 200 OK ResponseMARK SYNCEDUPDATE synced = 1Queue Drained Cleanly

5.1 Idempotency & Conflict Quarantine Protocol

  1. Deterministic Idempotency Key Injection: Every offline transaction enqueued includes a unique client-generated UUID idempotency key. When the server processes the replayed transaction, it validates that the key has not been previously committed.
  2. HTTP 409 Conflict Quarantine: If an item in the offline outbox conflicts with server state (such as an item sold out concurrently online while the physical register was offline), the server returns an HTTP 409 Conflict.
  3. Quarantine Isolation: The outbox worker flags the conflicting entry as quarantined (synced = -1), logs an audit notice, and proceeds to drain remaining transactions. This prevents a single failed line item from blocking the entire checkout queue.

6. Outbox Throughput & Cryptographic Latency Benchmarks

The embedded outbox delivers fast write throughput during offline operation:

Empirical System Benchmarks

Orbit Desktop Offline Outbox & Encryption Benchmark

Verified Dataset

P99 Barcode & Cart Ingestion

Hardware Validated
4.2ms
96% faster than REST polling

Continuous 60 FPS hardware scanner stream

Offline Replay Queue Durability

Air-Gapped Tested
100%
Zero dropped tickets during outage

Tested over 120-minute edge network drop

Double-Entry Ledger Variance

Audit Certified
0.00₨
Mathematical zero-drift balance

Strict transactional debits equals credits

Multi-Station KDS Event Dispatch

Sub-Millisecond
< 14ms
Real-time kitchen station routing

Simultaneous bump bar and kitchen chimes

Source: Production telemetry aggregated across Tier-1 retail, clinical, and dining deployments over a 180-day evaluation window.


7. Failure Modes & Recovery SOP

The following operational contingency protocols resolve offline storage exceptions:

FailureRoot CauseRecovery SOP
Embedded database busy timeout errorFile system lock held by external backup software or secondary processEnsure antivirus exclusions cover orbit_offline.db. The 5,000 ms busy timeout automatically retries; restart workstation if locks persist.
Decryption error during outbox replayDatabase file was moved to different physical computer; key mismatchOutbox files cannot be transferred across machines. Reconnect original hardware workstation to complete replay synchronization.
Replay stalled on HTTP 409 conflictDiscrepancy between offline cart inventory and online branch inventorySystem flags entry as quarantined. Store manager reviews conflict in administrative console and executes inventory adjustment voucher.
Disk space exhausted during long outageHigh transaction volume over multi-day outage exceeding storageSystem alerts operator at 80% disk capacity. Prune completed synced records via automated vacuum routine (VACUUM;).
Database WAL file corruptionHard power cutoff during un-buffered drive write on non-battery POSEmbedded engine automatically recovers upon connection open. If file header corrupted, restore from latest automated hourly snapshot.

8. Cross-Vertical Internal Linkages

The encrypted offline outbox secures offline transaction capture across all Orbit modules: