# `BaileysEx.Signal.LIDMappingStore`
[🔗](https://github.com/jeffhuen/baileys_ex/blob/main/lib/baileys_ex/signal/lid_mapping_store.ex#L1)

Store-backed PN<->LID mapping helpers aligned with Baileys' lookup rules.

User-level mappings are persisted in the `:"lid-mapping"` family using the
same forward/reverse keys Baileys writes (`pn_user` and `lid_user_reverse`).
Device-specific JIDs are derived at read time so Signal addressing preserves
per-device separation without duplicating stored rows.

Reverse PN lookup is intentionally limited to base `@lid` users, matching the
Baileys reference. Derived `@hosted.lid` device addresses are produced during
forward PN lookup, but are not treated as stored reverse-lookup identities.

# `error`

```elixir
@type error() :: :invalid_mapping
```

# `lookup_fun`

```elixir
@type lookup_fun() :: ([String.t()] -&gt; [mapping()] | nil)
```

# `mapping`

```elixir
@type mapping() :: %{pn: String.t(), lid: String.t()}
```

# `get_lid_for_pn`

```elixir
@spec get_lid_for_pn(BaileysEx.Signal.Store.t(), String.t(), keyword()) ::
  {:ok, String.t() | nil}
```

Retrieves the single valid LID value mapped to a distinct phone number identifier.

# `get_lids_for_pns`

```elixir
@spec get_lids_for_pns(BaileysEx.Signal.Store.t(), [String.t()], keyword()) ::
  {:ok, [mapping()] | nil}
```

Bulk-requests numerous LID identities tied to multiple phone numbers.

# `get_pn_for_lid`

```elixir
@spec get_pn_for_lid(BaileysEx.Signal.Store.t(), String.t()) ::
  {:ok, String.t() | nil}
```

Obtains a Phone Number from an alias LID mapped node structure.

# `get_pns_for_lids`

```elixir
@spec get_pns_for_lids(BaileysEx.Signal.Store.t(), [String.t()]) ::
  {:ok, [mapping()] | nil}
```

Loads multiple source Phone Numbers from Local Identifiers collectively.

# `store_lid_pn_mappings`

```elixir
@spec store_lid_pn_mappings(BaileysEx.Signal.Store.t(), [mapping()]) ::
  :ok | {:error, error()}
```

Records active mapping correlations between Phone Numbers and Local Identifiers to the store engine.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
