Amarula.Protocol.Signal.Group.SenderKeyStore (amarula v0.1.0)
View SourceFile-backed sender key store for group Signal sessions.
Mirrors SessionStore for 1:1 sessions. build/1 returns a store map with
load_sender_key and store_sender_key function fields that GroupCipher
and GroupSessionBuilder call. Each sender key is persisted via
Amarula.Storage (the :sender_key namespace, keyed by the sender-key-name
string), scoped to the connection conn (Amarula.Conn).
Summary
Functions
Build a store map bound to conn.
Load a SenderKeyRecord for sk_name on conn, or {:error, :not_found}.
Persist a SenderKeyRecord for sk_name on conn.
Functions
@spec build(Amarula.Conn.t()) :: %{ load_sender_key: (Amarula.Protocol.Signal.Group.SenderKeyName.t() -> {:ok, Amarula.Protocol.Signal.Group.SenderKeyRecord.t()} | {:error, :not_found}), store_sender_key: (Amarula.Protocol.Signal.Group.SenderKeyName.t(), Amarula.Protocol.Signal.Group.SenderKeyRecord.t() -> :ok | {:error, term()}) }
Build a store map bound to conn.
store = SenderKeyStore.build(conn)
{:ok, record} = store.load_sender_key(sk_name)
:ok = store.store_sender_key(sk_name, updated_record)
@spec load_sender_key( Amarula.Conn.t(), Amarula.Protocol.Signal.Group.SenderKeyName.t() ) :: {:ok, Amarula.Protocol.Signal.Group.SenderKeyRecord.t()} | {:error, :not_found}
Load a SenderKeyRecord for sk_name on conn, or {:error, :not_found}.
@spec store_sender_key( Amarula.Conn.t(), Amarula.Protocol.Signal.Group.SenderKeyName.t(), Amarula.Protocol.Signal.Group.SenderKeyRecord.t() ) :: :ok | {:error, term()}
Persist a SenderKeyRecord for sk_name on conn.