Trusted-contact token helpers aligned with Baileys' privacy-token flow.
Summary
Functions
Append a stored TC token node to the provided content list.
Build a tctoken child node for a JID when a stored token exists.
Fetch trusted-contact privacy tokens for the given JIDs.
Handle a privacy_token notification by persisting trusted-contact tokens.
Issue a fresh trusted-contact token after an eligible outgoing 1:1 message.
Returns true for user JIDs that can participate in trusted-contact token flows.
Re-issue trusted-contact tokens after a peer identity changes.
Store trusted-contact tokens returned by a privacy-token IQ result.
Functions
@spec build_content( BaileysEx.Signal.Store.t() | nil, String.t(), [BaileysEx.BinaryNode.t()], keyword() ) :: [BaileysEx.BinaryNode.t()] | nil
Append a stored TC token node to the provided content list.
Mirrors Baileys buildTcTokenFromJid: if no token exists, returns the
existing content when present or nil when it is empty.
@spec build_node(BaileysEx.Signal.Store.t() | nil, String.t(), keyword()) :: BaileysEx.BinaryNode.t() | nil
Build a tctoken child node for a JID when a stored token exists.
@spec get_privacy_tokens(term(), [String.t()], keyword()) :: {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}
Fetch trusted-contact privacy tokens for the given JIDs.
@spec handle_notification( BaileysEx.BinaryNode.t(), keyword() ) :: :ok
Handle a privacy_token notification by persisting trusted-contact tokens.
@spec issue_after_outgoing_message( term(), BaileysEx.Signal.Store.t() | nil, String.t(), keyword() ) :: :ok | {:error, term()}
Issue a fresh trusted-contact token after an eligible outgoing 1:1 message.
Returns true for user JIDs that can participate in trusted-contact token flows.
@spec reissue_after_identity_change( term(), BaileysEx.Signal.Store.t() | nil, String.t(), keyword() ) :: :ok | {:error, term()}
Re-issue trusted-contact tokens after a peer identity changes.
@spec store_from_iq_result(BaileysEx.BinaryNode.t(), String.t() | nil, keyword()) :: :ok
Store trusted-contact tokens returned by a privacy-token IQ result.