Amarula.Protocol.Signal.Types (amarula v0.1.0)
View SourceCore Signal Protocol types and data structures.
Defines all the data structures used in the Signal Protocol implementation, including keys, sessions, addresses, and encryption options.
Summary
Types
@type decrypt_opts() :: %{jid: String.t(), type: message_type(), ciphertext: binary()}
@type e2e_session() :: %{ registration_id: non_neg_integer(), identity_key: binary(), signed_pre_key: signed_pre_key(), pre_key: pre_key() }
@type encrypt_result() :: %{type: message_type(), ciphertext: binary()}
@type key_store_opts() :: %{ table_name: atom(), cleanup_interval: non_neg_integer(), max_size: non_neg_integer() }
@type key_type() :: :session | :prekey | :identity | :sender_key
@type lid_mapping_result() :: %{mappings: [lid_mapping()], missing: [String.t()]}
@type message_type() :: :pkmsg | :msg
@type migration_result() :: %{ migrated: non_neg_integer(), skipped: non_neg_integer(), total: non_neg_integer() }
@type pre_key() :: %{key_id: non_neg_integer(), public_key: binary()}
@type protocol_address() :: %{name: String.t(), device_id: non_neg_integer()}
@type session_info() :: %{ jid: String.t(), state: session_state(), created_at: DateTime.t(), last_used: DateTime.t() | nil, message_count: non_neg_integer() }
@type session_state() :: :active | :inactive | :pending | :expired
@type signal_config() :: %{ key_store: key_store_opts(), session_timeout: non_neg_integer(), max_sessions: non_neg_integer(), enable_lid_mapping: boolean(), cache_ttl: non_neg_integer() }
@type signal_creds() :: %{ signed_identity_key: key_pair(), signed_pre_key: signed_key_pair(), registration_id: non_neg_integer() }
@type signal_identity() :: %{identifier: protocol_address(), identifier_key: binary()}
@type signed_key_pair() :: %{ key_pair: key_pair(), signature: binary(), key_id: non_neg_integer(), timestamp_s: non_neg_integer() | nil }