Amarula.Protocol.Signal.LIDMapping (amarula v0.1.0)

View Source

LID (Local ID) mapping types and utilities.

LID mapping is used to convert between Phone Number (PN) JIDs and Local ID (LID) JIDs for WhatsApp's privacy features. This allows users to communicate without exposing their phone numbers.

Summary

Functions

Constructs a device-specific JID.

Decodes a JID into its components.

Checks if a JID is a hosted phone number user.

Checks if a JID is a LID user.

Creates a new LID mapping.

Normalizes a JID to its user part.

Checks if a JID is a phone number user.

Types

t()

@type t() :: %Amarula.Protocol.Signal.LIDMapping{lid: String.t(), pn: String.t()}

Functions

construct_device_jid(user, device, domain)

@spec construct_device_jid(String.t(), non_neg_integer(), String.t()) :: String.t()

Constructs a device-specific JID.

decode_jid(jid)

@spec decode_jid(String.t()) :: {:ok, map()} | {:error, String.t()}

Decodes a JID into its components.

hosted_pn_user?(jid)

@spec hosted_pn_user?(String.t()) :: boolean()

Checks if a JID is a hosted phone number user.

lid_user?(jid)

@spec lid_user?(String.t()) :: boolean()

Checks if a JID is a LID user.

new(pn, lid)

@spec new(String.t(), String.t()) :: t()

Creates a new LID mapping.

normalize_user(jid)

@spec normalize_user(String.t()) :: String.t()

Normalizes a JID to its user part.

pn_user?(jid)

@spec pn_user?(String.t()) :: boolean()

Checks if a JID is a phone number user.