Envelope decode helpers aligned with Baileys' message addressing rules.
The decoded envelope intentionally keeps two sender identities:
author_jidis the message author for higher-level message semantics and logssignal_author_jidis the sender identity Signal group crypto should key on
Those values are usually the same, but direct device-addressed payloads can carry a
bare chat author in from and the device-qualified sender in participant. Group
sender-key distribution and skmsg decrypts must use the device-qualified identity,
while normalized received messages should continue to expose the stable author JID.
Summary
Functions
Decodes a protocol envelope from the given binary node, analyzing addressing.
Extracts basic addressing details (mode and alternate identifiers) from a node.
Types
@type context() :: %{ :signal_repository => BaileysEx.Signal.Repository.t(), :me_id => String.t(), optional(:me_lid) => String.t(), optional(atom()) => term() }
@type envelope() :: %{ :remote_jid => String.t(), optional(:remote_jid_alt) => String.t(), optional(:participant) => String.t(), optional(:participant_alt) => String.t(), optional(:server_id) => String.t(), from_me: boolean(), author_jid: String.t(), signal_author_jid: String.t(), decryption_jid: String.t(), addressing_mode: :pn | :lid }
Functions
@spec decode_envelope(BaileysEx.BinaryNode.t(), context()) :: {:ok, envelope(), context()} | {:error, term()}
Decodes a protocol envelope from the given binary node, analyzing addressing.
The returned envelope separates message semantics from crypto semantics so later pipeline stages do not need to rediscover which sender identity Signal should use.
Extracts basic addressing details (mode and alternate identifiers) from a node.