Amarula.Protocol.Signal.Group.SenderKeyName (amarula v0.1.0)

View Source

Represents a sender key name for group encryption.

A sender key name uniquely identifies a sender key for a specific group and sender. It consists of a group ID and sender information (JID + device ID).

Summary

Functions

Checks if two SenderKeyNames are equal.

Build a SenderKeyName from the group JID and author JID, mirroring Baileys jidToSignalSenderKeyName: the group JID is used AS-IS (full "...@g.us" string), the author becomes a signal protocol address (user, or "user_<domainType>" for non-WhatsApp domains like lid, plus device).

Parses a string representation back to a SenderKeyName.

Generates a hash code for the SenderKeyName.

Creates a new SenderKeyName.

Converts the SenderKeyName to a string representation.

Types

sender()

@type sender() :: %{id: String.t(), device_id: non_neg_integer()}

t()

@type t() :: %Amarula.Protocol.Signal.Group.SenderKeyName{
  group_id: String.t(),
  sender: sender()
}

Functions

equal?(sender_key_name1, sender_key_name2)

@spec equal?(t(), t()) :: boolean()

Checks if two SenderKeyNames are equal.

from_jids(group_jid, author_jid)

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

Build a SenderKeyName from the group JID and author JID, mirroring Baileys jidToSignalSenderKeyName: the group JID is used AS-IS (full "...@g.us" string), the author becomes a signal protocol address (user, or "user_<domainType>" for non-WhatsApp domains like lid, plus device).

Both the SKDM-store path and the skmsg-decrypt path MUST use this so the sender key is found under the same name.

from_string(string)

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

Parses a string representation back to a SenderKeyName.

hash_code(sender_key_name)

@spec hash_code(t()) :: integer()

Generates a hash code for the SenderKeyName.

new(group_id, sender_id, device_id)

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

Creates a new SenderKeyName.

to_string_repr(sender_key_name)

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

Converts the SenderKeyName to a string representation.