Public Signal repository boundary for connection and messaging consumers.
This module owns JID-to-Signal address translation, session bundle normalization, and the Elixir-facing return contracts. The cryptographic and session engine stays behind an adapter boundary, keeping the native surface minimal.
Summary
Types
Injected peer session bundle used to bootstrap an outgoing session.
Repository result for validate_session/2.
Functions
Unlocks specific multi-cast message transmissions directly correlating known participant identifiers.
Reconstructs unencrypted cleartext directly from isolated Signal whisper responses.
Wipes persistent E2E tracks for corresponding device list JIDs.
Translates structural Sender Keys payloads to encrypt multirecipient group broadcasts.
Applies standard E2E Signal encryption payload converting binary messages to opaque node cipher blobs.
Maps traditional PN JID addresses towards localized identifiers dynamically resolving contexts.
Performs reverse mappings identifying real users masked via LID instances.
Safely decodes and writes an externally sourced E2E session state payload into the engine.
Converts a standard text JID to its internal Signal Protocol identifier strictly.
Pulls identity key data strictly for known device associations.
Moves established sessions to new aliases honoring WhatsApp's complex LID migration semantics safely.
Initializes a unified Signal Repository utilizing the provided config options.
Parses out group Sender key payloads sent from others ensuring group chats successfully decode.
TOFU processes and saves inbound device identity exchanges overriding any older values when matching.
Pass-through to LID maps linking canonical WA protocol endpoints.
Checks the store bounds asserting whether an active encrypted session currently exists.
Types
@type adapter_error() :: :invalid_ciphertext | :invalid_identity_key | :invalid_session | :invalid_signal_address | :no_sender_key_state | :no_session | term()
@type e2e_session() :: %{ registration_id: non_neg_integer(), identity_key: binary(), signed_pre_key: %{ key_id: non_neg_integer(), public_key: binary(), signature: binary() }, pre_key: %{key_id: non_neg_integer(), public_key: binary()} }
Injected peer session bundle used to bootstrap an outgoing session.
@type migration_operation() :: %{ from: BaileysEx.Signal.Address.t(), to: BaileysEx.Signal.Address.t(), pn_user: String.t(), lid_user: String.t(), device_id: non_neg_integer() }
@type migration_result() :: %{ migrated: non_neg_integer(), skipped: non_neg_integer(), total: non_neg_integer() }
@type session_status() ::
%{exists: true}
| %{exists: false, reason: :no_session | :no_open_session | :validation_error}
Repository result for validate_session/2.
@type t() :: %BaileysEx.Signal.Repository{ adapter: module(), adapter_state: term(), pn_to_lid_lookup: BaileysEx.Signal.LIDMappingStore.lookup_fun() | nil, store: BaileysEx.Signal.Store.t() }
Functions
@spec decrypt_group_message(t(), %{ group: String.t(), author_jid: String.t(), msg: binary() }) :: {:ok, t(), binary()} | {:error, adapter_error()}
Unlocks specific multi-cast message transmissions directly correlating known participant identifiers.
@spec decrypt_message(t(), %{ jid: String.t(), type: :pkmsg | :msg, ciphertext: binary() }) :: {:ok, t(), binary()} | {:error, adapter_error()}
Reconstructs unencrypted cleartext directly from isolated Signal whisper responses.
@spec delete_session(t(), [String.t()]) :: {:ok, t()} | {:error, adapter_error()}
Wipes persistent E2E tracks for corresponding device list JIDs.
@spec encrypt_group_message(t(), %{ group: String.t(), me_id: String.t(), data: binary() }) :: {:ok, t(), %{ciphertext: binary(), sender_key_distribution_message: binary()}} | {:error, adapter_error()}
Translates structural Sender Keys payloads to encrypt multirecipient group broadcasts.
@spec encrypt_message(t(), %{jid: String.t(), data: binary()}) :: {:ok, t(), %{type: :pkmsg | :msg, ciphertext: binary()}} | {:error, adapter_error()}
Applies standard E2E Signal encryption payload converting binary messages to opaque node cipher blobs.
Maps traditional PN JID addresses towards localized identifiers dynamically resolving contexts.
Performs reverse mappings identifying real users masked via LID instances.
@spec inject_e2e_session(t(), %{jid: String.t(), session: e2e_session()}) :: {:ok, t()} | {:error, adapter_error()}
Safely decodes and writes an externally sourced E2E session state payload into the engine.
@spec jid_to_signal_protocol_address(String.t()) :: {:ok, String.t()} | {:error, :invalid_signal_address}
Converts a standard text JID to its internal Signal Protocol identifier strictly.
@spec load_identity_key(t(), String.t()) :: {:ok, t(), binary() | nil} | {:error, adapter_error()}
Pulls identity key data strictly for known device associations.
@spec migrate_session(t(), String.t(), String.t()) :: {:ok, t(), migration_result()} | {:error, adapter_error()}
Moves established sessions to new aliases honoring WhatsApp's complex LID migration semantics safely.
Initializes a unified Signal Repository utilizing the provided config options.
@spec process_sender_key_distribution_message( t(), %{ author_jid: String.t(), item: %{ group_id: String.t() | nil, axolotl_sender_key_distribution_message: binary() | nil } } ) :: {:ok, t()} | {:error, adapter_error()}
Parses out group Sender key payloads sent from others ensuring group chats successfully decode.
@spec save_identity(t(), %{jid: String.t(), identity_key: binary()}) :: {:ok, t(), boolean()} | {:error, adapter_error()}
TOFU processes and saves inbound device identity exchanges overriding any older values when matching.
@spec store_lid_pn_mappings(t(), [BaileysEx.Signal.LIDMappingStore.mapping()]) :: {:ok, t()} | {:error, BaileysEx.Signal.LIDMappingStore.error()}
Pass-through to LID maps linking canonical WA protocol endpoints.
@spec validate_session(t(), String.t()) :: {:ok, session_status()} | {:error, adapter_error()}
Checks the store bounds asserting whether an active encrypted session currently exists.