Skip to content

LibEmiddle v2.6.0

Choose a tag to compare

@rbenzing rbenzing released this 21 Mar 22:48
· 61 commits to main since this release

🎯 Overview

Production-readiness sprint delivering security hardening, encrypted persistence, structured error handling, and comprehensive test coverage across the full Signal Protocol stack.


✨ What's New

πŸ”’ Security Hardening

  • NEW: Group session replay attack protection β€” per-sender message ID tracking with 1,000-entry cap
  • NEW: Chat session replay protection β€” 500-message sliding window FIFO ring buffer
  • NEW: Post-removal forward secrecy β€” automatic chain key rotation when a group member is removed
  • NEW: Encrypted device list persistence β€” AES-GCM authenticated storage with atomic writes

πŸ“‘ API & Messaging

  • NEW: StartListeningAsync() now auto-starts mailbox polling β€” no extra call needed
  • NEW: O(1) message routing via SenderIdentityKey field on EncryptedMessage β€” replaces O(n) brute-force session scan
  • NEW: CreateChatSessionAsync(byte[] identityKey) overload β€” cache-first, transport fallback
  • NEW: SendToDeviceAsync(deviceId, message) β€” device-to-device encrypted message routing
  • NEW: FetchRecipientKeyBundleAsync() β€” validates bundle signature before caching
  • NEW: OPKManager one-time prekey consumption tracking with automatic replenishment

πŸ—„οΈ Persistence & Lifecycle

  • NEW: DeviceStorage β€” survives process restarts with encrypted device list files
  • NEW: IAsyncDisposable on LibEmiddleClient β€” safe await using cleanup
  • NEW: LibEmiddleException with typed LibEmiddleErrorCode β€” 12 structured error codes replacing generic exceptions

πŸ§ͺ Testing

  • NEW: Concurrency tests β€” 7 tests covering multi-thread encrypt/decrypt, session isolation, nonce uniqueness
  • NEW: Stress tests β€” 10 sessions Γ— 50 messages, 5 group sessions Γ— 20 messages, error path coverage

⚠️ Important Changes

  • Password KDF migrated from HKDF + fixed salt to Argon2id (64 MB, 2 passes) β€” stronger brute-force resistance
  • SecureWebSocketClient now throws LibEmiddleException(TransportError) instead of bare Exception
  • Fixed AES-GCM detached decryption P/Invoke signature (was silently failing all decryption)
  • Fixed MessageSigning.VerifyObject<T>() reversed argument order (was failing all signature verification)

βœ… Compatibility

Fully backward compatible with v2.5.1 β€” drop-in replacement, no code changes needed for existing integrations.


πŸ“Š Testing

  • βœ… 532 tests passing (up from 388 baseline)
  • βœ… No breaking changes
  • βœ… No new failures