Group sender-key support for WhatsApp skmsg payloads.
Handles:
- processing sender key distribution messages from decrypted WA message payloads
- decrypting sender-key group messages (
enc type="skmsg")
Summary
Functions
Creates (or reuses) the local outbound sender-key state and returns a WA message
payload containing senderKeyDistributionMessage (field 2).
Decrypts a group sender-key message (skmsg) for a specific group and sender.
Encrypts plaintext for outbound group send as a sender-key message (skmsg).
Parses and persists any sender key distribution payloads found inside a decrypted WhatsApp message protobuf.
Types
@type sender_key_state() :: %{ id: non_neg_integer(), iteration: non_neg_integer(), chain_key: binary(), signing_key: binary(), signing_private: binary() | nil, message_keys: %{optional(non_neg_integer()) => sender_key_message_keys()} }
Functions
@spec create_outbound_distribution_message(ExWapp.Store.t(), term(), term()) :: {:ok, binary()} | {:error, term()}
Creates (or reuses) the local outbound sender-key state and returns a WA message
payload containing senderKeyDistributionMessage (field 2).
@spec decrypt_group_message(ExWapp.Store.t(), term(), term(), binary()) :: {:ok, binary()} | {:error, term()}
Decrypts a group sender-key message (skmsg) for a specific group and sender.
@spec encrypt_outbound_group_message(ExWapp.Store.t(), term(), term(), binary()) :: {:ok, binary()} | {:error, term()}
Encrypts plaintext for outbound group send as a sender-key message (skmsg).
@spec process_distributions_from_plaintext( ExWapp.Store.t() | nil, term(), term(), binary() ) :: {:ok, non_neg_integer()} | {:error, term()}
Parses and persists any sender key distribution payloads found inside a decrypted WhatsApp message protobuf.
Returns {:ok, processed_count}.