Runtime-backed Signal key store boundary aligned with Baileys' keys contract.
The store exposes three core operations:
get/3for keyed reads by logical familyset/2for batched updates and deletions (nilremoves an entry)transaction/3for per-key serialized work through an explicit transaction-scoped store handle
Custom store modules must pass that transaction-scoped handle into the closure:
transaction(ref, "session:alice", fn tx_ref ->
existing = get(tx_ref, :session, ["alice.0"])
:ok = set(tx_ref, %{session: %{"alice.0" => updated}})
existing
end)Concrete persistence remains swappable. The default in-memory runtime implementation can be replaced with file/ETS/DB-backed variants without changing repository consumers.
Summary
Types
Logical key families matching Baileys' Signal store.
One value written under a logical key family.
Store handle passed to repository and helper modules.
Functions
Flushes the data store completely.
Extracts values from the store sequentially resolving cache items.
Examines if identical transaction processes cover the ongoing context stack.
Start a caller-owned store and return its wrapped Signal Store handle.
Persists an explicitly typed data set definition back to the store.
Start the underlying store process using the standard OTP child contract.
Executes work inside of a logically consistent mutex-isolated transaction.
Resolve a running store process or {module, server} tuple into a wrapped
BaileysEx.Signal.Store handle.
Types
@type data_entries() :: %{optional(String.t()) => data_value()}
@type data_set() :: %{ optional(data_type()) => %{optional(String.t()) => data_value() | nil} }
@type data_type() ::
:session
| :"pre-key"
| :"sender-key"
| :"sender-key-memory"
| :"app-state-sync-key"
| :"app-state-sync-version"
| :"lid-mapping"
| :"device-list"
| :tctoken
| :"identity-key"
Logical key families matching Baileys' Signal store.
@type data_value() :: binary() | [String.t()] | %{optional(String.t()) => boolean()} | %{:token => binary(), optional(:timestamp) => String.t()} | %{public: binary(), private: binary()} | term()
One value written under a logical key family.
Store handle passed to repository and helper modules.
Callbacks
@callback clear(term()) :: :ok
@callback get(term(), data_type(), [String.t()]) :: data_entries()
@callback start_link(keyword()) :: start_result()
Functions
@spec clear(t()) :: :ok
Flushes the data store completely.
@spec get(t(), data_type(), [String.t()]) :: data_entries()
Extracts values from the store sequentially resolving cache items.
Examines if identical transaction processes cover the ongoing context stack.
Start a caller-owned store and return its wrapped Signal Store handle.
This is convenient for tests and scripts. Long-lived stores should be started
from a supervision tree with start_link/1 and wrapped with wrap_running/1.
Persists an explicitly typed data set definition back to the store.
@spec start_link(keyword()) :: start_result()
Start the underlying store process using the standard OTP child contract.
Executes work inside of a logically consistent mutex-isolated transaction.
The callback receives a transaction-scoped store handle. Reads and writes that should participate in the transaction must use that handle, not the outer non-transactional store handle.
Resolve a running store process or {module, server} tuple into a wrapped
BaileysEx.Signal.Store handle.