Amarula.Protocol.Signal.Group.SenderKeyRecord (amarula v0.1.0)
View SourceRepresents a sender key record containing multiple sender key states.
A sender key record can contain up to 5 sender key states, allowing for key rotation and backward compatibility.
Summary
Functions
Adds a sender key state to the record.
Checks if the record is empty.
Creates a SenderKeyRecord from serialized data.
Gets the first (most recent) sender key state.
Gets the sender key state with the given key ID.
Creates a new empty SenderKeyRecord.
Serializes the record to a list of maps.
Gets the number of sender key states in the record.
Updates an existing sender key state in the record. If the state doesn't exist, adds it as a new state.
Types
@type t() :: %Amarula.Protocol.Signal.Group.SenderKeyRecord{ sender_key_states: [Amarula.Protocol.Signal.Group.SenderKeyState.t()] }
Functions
@spec add_sender_key_state(t(), Amarula.Protocol.Signal.Group.SenderKeyState.t()) :: t()
Adds a sender key state to the record.
Checks if the record is empty.
Creates a SenderKeyRecord from serialized data.
@spec get_sender_key_state(t()) :: {:ok, Amarula.Protocol.Signal.Group.SenderKeyState.t()} | {:error, String.t()}
Gets the first (most recent) sender key state.
@spec get_sender_key_state(t(), non_neg_integer()) :: {:ok, Amarula.Protocol.Signal.Group.SenderKeyState.t()} | {:error, String.t()}
Gets the sender key state with the given key ID.
@spec new() :: t()
Creates a new empty SenderKeyRecord.
Serializes the record to a list of maps.
@spec state_count(t()) :: non_neg_integer()
Gets the number of sender key states in the record.
@spec update_sender_key_state(t(), Amarula.Protocol.Signal.Group.SenderKeyState.t()) :: t()
Updates an existing sender key state in the record. If the state doesn't exist, adds it as a new state.