ExWapp.Pairing (ExWapp v0.1.2)

Copy Markdown View Source

Implements the QR-code based pairing handshake used by WhatsApp Web.

Summary

Types

Aggregate structure that keeps temporary pairing data.

Functions

Applies a decoded node and returns the updated state plus pairing events.

Returns the initial pairing state.

Turns the server-provided ref into a QR string.

Types

state()

@type state() :: %{
  status: :idle | :waiting_for_scan | :waiting_for_code | :paired,
  ref: String.t() | nil,
  store: ExWapp.Store.t(),
  req_id: String.t() | nil
}

Aggregate structure that keeps temporary pairing data.

Functions

apply_node(state, arg2)

@spec apply_node(state(), ExWapp.Binary.binary_node()) :: {state(), [term()]}

Applies a decoded node and returns the updated state plus pairing events.

new(store)

@spec new(ExWapp.Store.t()) :: state()

Returns the initial pairing state.

qr_from_ref(arg1, ref)

@spec qr_from_ref(state(), binary()) :: String.t()

Turns the server-provided ref into a QR string.