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

View Source

Sender key distribution message, ported from src/Signal/Group/sender-key-distribution-message.ts.

Wire format: [version byte][Proto.SenderKeyDistributionMessage] where version = (3 << 4) | 3 = 0x33. No signature — the SKDM travels inside an already-encrypted Signal message.

Summary

Functions

Parses a serialized SenderKeyDistributionMessage ([version][protobuf]). Malformed protobuf raises — let it crash.

Gets the ID of the sender key.

Creates a new SenderKeyDistributionMessage. signature_key is the public signing key in wire form (33 bytes, 0x05-prefixed).

Types

t()

@type t() :: %Amarula.Protocol.Signal.Group.SenderKeyDistributionMessage{
  chain_key: binary(),
  id: integer(),
  iteration: integer(),
  serialized: binary(),
  signature_key: binary()
}

Functions

from_serialized(serialized)

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

Parses a serialized SenderKeyDistributionMessage ([version][protobuf]). Malformed protobuf raises — let it crash.

get_chain_key(sender_key_distribution_message)

@spec get_chain_key(t()) :: binary()

Gets the chain key.

get_id(sender_key_distribution_message)

@spec get_id(t()) :: integer()

Gets the ID of the sender key.

get_iteration(sender_key_distribution_message)

@spec get_iteration(t()) :: integer()

Gets the iteration count.

get_serialized(sender_key_distribution_message)

@spec get_serialized(t()) :: binary()

Gets the serialized message.

get_signature_key(sender_key_distribution_message)

@spec get_signature_key(t()) :: binary()

Gets the signature key.

new(id, iteration, chain_key, signature_key)

@spec new(integer(), integer(), binary(), binary()) :: t()

Creates a new SenderKeyDistributionMessage. signature_key is the public signing key in wire form (33 bytes, 0x05-prefixed).