github oxidezap/whatsapp-rust v0.5.0

latest releases: v0.7.0, v0.6.0
7 months ago

Breaking Changes

Why these changes? These breaking changes eliminate per-message serialization, deserialization, and heap allocations from the Signal protocol encrypt/decrypt hot path — matching WhatsApp Web's architecture where session and sender key objects are cached in memory and only serialized during periodic flush to storage. In benchmarks, this reduces ~70% of the CPU cost that was previously spent on protobuf encode/decode and unnecessary cloning on every message.

Trait signature changes

Downstream implementations of these traits must update:

  • SessionStore::store_session — record: &SessionRecord → record: SessionRecord (takes ownership)
  • SenderKeyStore::store_sender_key — record: &SenderKeyRecord → record: SenderKeyRecord (takes ownership)

SignalStoreCache API

All methods now accept typed addresses instead of &str:

Method Before After
get_session &str → Option<Arc<[u8]>> &ProtocolAddress → Option<SessionRecord>
put_session &str, &[u8] &ProtocolAddress, SessionRecord
delete_session &str &ProtocolAddress
has_session &str &ProtocolAddress
get_sender_key &str → Option<Arc<[u8]>> &SenderKeyName → Option<SenderKeyRecord>
put_sender_key &str, &[u8] &SenderKeyName, SenderKeyRecord

Struct changes

  • ProtocolAddress — added private display field; struct literal construction no longer works, use ProtocolAddress::new()
  • SenderKeyName — added private cache_key field; struct literal construction no longer works, use SenderKeyName::new()

What's Changed

  • fix: persist Device.account through serde by @jlucaso1 in #414
  • perf: typed cache API + sender key object cache by @jlucaso1 in #415
  • feat: MediaEncryptor streaming API + PortableCache fixes by @jlucaso1 in #416

Full Changelog: v0.4.3...v0.5.0

Don't miss a new whatsapp-rust release

NewReleases is sending notifications on new releases.