Amarula.Protocol.Messages.MessageDecryptor (amarula v0.1.0)
View SourceDecrypts the <enc> payloads of an incoming message node, ported from the
routing in src/Utils/decode-wa-message.ts (decryptMessageNode).
For each <enc> child it dispatches by type:
pkmsg/msg→ 1:1 Signal session cipher (SessionCipher)plaintext→ passthroughskmsg→ group sender-key (not handled here yet; left to caller)
The decrypted bytes are unpadded (random-max-16) and decoded as a
Proto.Message, unwrapping deviceSentMessage.
Sessions are loaded/stored via SessionStore keyed by the sender's signal
address. This module is pure aside from the session file I/O.
Summary
Functions
Decrypt all decryptable <enc> children of node.
Functions
Decrypt all decryptable <enc> children of node.
Returns {:ok, [%Proto.Message{}], used_pre_key_ids} (one message per
successfully decrypted enc), or {:ok, [], []} if nothing decryptable.
used_pre_key_ids lists our one-time prekey ids consumed by
PreKeySignalMessages — the caller must delete them from storage, as
libsignal's session_cipher does via removePreKey. opts requires:
:store— the cipher store fromSessionStore.build/1:conn— theAmarula.Connscoping session persistence