Implements WhatsApp's phone-number (link-code) companion pairing protocol.
The request side wraps a fresh companion ephemeral public key with the eight-character pairing code. The finish side unwraps the primary phone's ephemeral key, derives the authenticated key bundle, rotates the ADV secret, and persists enough account state for the reconnect/login that follows.
Summary
Functions
Encodes bytes with WhatsApp's Crockford alphabet.
Derives the AES key used to wrap link-code ephemeral public keys.
Completes a pending link-code pairing from a server notification.
Starts a link-code pairing request and persists its ephemeral credentials.
Types
Functions
Encodes bytes with WhatsApp's Crockford alphabet.
Derives the AES key used to wrap link-code ephemeral public keys.
@spec finish(ExWapp.Store.t(), ExWapp.Binary.Node.t()) :: {:ok, finish_result()} | {:error, term()}
Completes a pending link-code pairing from a server notification.
The returned node is the companion_finish IQ that must be sent before the
server's expected reconnect. Credential persistence is completed before this
function returns.
@spec request(ExWapp.Store.t(), String.t(), keyword(), map()) :: {:ok, request_result()} | {:error, term()}
Starts a link-code pairing request and persists its ephemeral credentials.
A custom code follows the upstream contract: it must be exactly eight bytes. When omitted, five random bytes are encoded with WhatsApp's Crockford alphabet, producing an eight-character code.