Post-authentication helpers triggered after the success node is received.
Handles LID persistence, PN↔LID mapping, prekey count queries, and prekey upload logic.
Summary
Functions
Handles the response to the digest query and finalizes post-auth.
Handles the response to SetPassive(false) and finalizes post-auth by default.
Handles the prekey count response from the server and decides whether to upload.
Handles the response to a prekey upload IQ.
Persists the LID value from the success node and creates own PN↔LID mapping.
Refills the server prekey pool after an encrypt inventory notification.
Starts the post-auth flow after receiving the success node.
Functions
@spec handle_digest_response( ExWapp.Binary.Node.t(), String.t(), map(), (-> ExWapp.Binary.Node.t()) ) :: {map(), list()}
Handles the response to the digest query and finalizes post-auth.
@spec handle_passive_response( ExWapp.Binary.Node.t(), String.t(), map(), (-> ExWapp.Binary.Node.t()), (-> ExWapp.Binary.Node.t()) ) :: {map(), list()}
Handles the response to SetPassive(false) and finalizes post-auth by default.
Digest validation can be re-enabled with runtime: [protocol: [post_auth_digest_enabled: true]].
@spec handle_prekey_count_response( ExWapp.Binary.Node.t(), map(), (-> ExWapp.Binary.Node.t()) ) :: {map(), list()}
Handles the prekey count response from the server and decides whether to upload.
Returns {state, actions}.
@spec handle_prekey_upload_response( ExWapp.Binary.Node.t(), String.t(), map(), (-> ExWapp.Binary.Node.t()) ) :: {map(), list()}
Handles the response to a prekey upload IQ.
@spec persist_lid_and_mapping(ExWapp.Session.Worker.t(), binary() | nil) :: ExWapp.Session.Worker.t()
Persists the LID value from the success node and creates own PN↔LID mapping.
@spec refill_from_notification(ExWapp.Session.Worker.t(), non_neg_integer()) :: {ExWapp.Session.Worker.t(), list()}
Refills the server prekey pool after an encrypt inventory notification.
The upload restores the pool toward the configured initial size instead of adding only a tiny fixed batch. An already in-flight upload is left alone.
@spec start(ExWapp.Session.Worker.t(), (-> ExWapp.Binary.Node.t())) :: {ExWapp.Session.Worker.t(), list()}
Starts the post-auth flow after receiving the success node.
To preserve live inbound delivery, the activation path mirrors the older working runtime sequence:
- query prekey count
- send
SetPassive(false)immediately - send
presence type="available"immediately - upload prekeys later only if the server count requires it
Digest validation remains available as an explicit opt-in, but it is disabled by default because some fresh-pair sessions are being invalidated immediately after the digest IQ is sent.