Validates trusted-contact privacy tokens used by direct-message sends.
WhatsApp rotates these tokens in seven-day buckets and accepts the current bucket plus the previous three. Tokens outside that window must not be attached to outbound stanzas.
Summary
Functions
Stores record under every JID in jids, keeping whichever token is newer.
Types
@type tctoken_record() :: %{ :token => binary(), :timestamp => non_neg_integer() | String.t(), optional(:sender_timestamp) => non_neg_integer() | String.t() | nil }
Functions
@spec normalize_timestamp(term()) :: {:ok, non_neg_integer()} | :error
Stores record under every JID in jids, keeping whichever token is newer.
One contact reaches the store under several JID aliases (phone number and LID), and the same token arrives through more than one path — a notification and a history sync chunk. Overwriting blindly would let a stale copy win.