ExWapp.Session.Outbound.Group (ExWapp v0.1.2)

Copy Markdown View Source

Group-specific outbound transformations and routing decisions.

The session worker remains responsible for transport calls, response receives, timeouts, persistence, and retries. This module owns sender-key payload construction, group target selection, group IQ shapes, and group message-node composition.

Summary

Functions

Builds the IQ node used to request interactive group information.

Creates the sender-key distribution payload and encrypted group payload.

Normalizes the group session preparation result.

Parses the interactive group information response.

Builds the participant and local-account JIDs for the group USync query.

Types

group_info()

@type group_info() :: %{participants: [String.t()], addressing_mode: String.t() | nil}

Functions

build_encrypted_message_node(group_jid, message_id, participant_nodes, skmsg_payload, addressing_mode, store, include_identity)

@spec build_encrypted_message_node(
  String.t(),
  String.t(),
  [ExWapp.Binary.Node.t()],
  binary(),
  term(),
  term(),
  boolean()
) :: ExWapp.Binary.Node.t()

Builds the final encrypted group message node.

build_info_query(group_jid, message_id)

@spec build_info_query(String.t(), String.t()) :: ExWapp.Binary.Node.t()

Builds the IQ node used to request interactive group information.

build_sender_key_payloads(store, group_jid, message_payload)

@spec build_sender_key_payloads(term(), String.t(), binary()) ::
  {:ok, binary(), binary()} | {:error, term()}

Creates the sender-key distribution payload and encrypted group payload.

distribution_targets(query_jids, device_map, addressing_mode, own_device_id, own_base_jid, own_lid_jid, store, runtime_cfg)

@spec distribution_targets(
  [term()],
  map(),
  term(),
  non_neg_integer() | nil,
  String.t(),
  String.t(),
  term(),
  map()
) :: {[String.t()], [String.t()]}

Resolves live and cached sender-key distribution targets.

Targets incompatible with the group's addressing mode and the current local device are excluded.

finalize_sessions_result(sessions, prekey_bundles, distribution_targets)

@spec finalize_sessions_result(
  {:error, term()} | ExWapp.Signal.SessionStore.t(),
  map(),
  [String.t()]
) ::
  {:error, term()} | {:ok, ExWapp.Signal.SessionStore.t(), map(), [String.t()]}

Normalizes the group session preparation result.

parse_info_response(node, group_jid)

@spec parse_info_response(term(), String.t()) ::
  {:ok, group_info()} | {:error, term()}

Parses the interactive group information response.

prekey_targets(distribution_targets, runtime_cfg, signal_sessions, lid_mapping, own_base_jid, own_lid_jid, now_ms)

@spec prekey_targets(
  [term()],
  map(),
  ExWapp.Signal.SessionStore.t(),
  map(),
  String.t(),
  String.t(),
  non_neg_integer()
) :: [String.t()]

Selects group distribution targets that need a prekey bootstrap.

query_jids(participant_jids, addressing_mode, own_base_jid, own_lid_jid)

@spec query_jids([term()], term(), String.t(), String.t()) :: [String.t()]

Builds the participant and local-account JIDs for the group USync query.