Implements the Noise_XX_25519_AESGCM_SHA256 handshake used by WhatsApp Web.
The module exposes helpers to produce the client hello, process the server hello (including certificate verification) and to encrypt/decrypt transport payloads once the handshake completes.
Summary
Functions
Decrypts a transport payload once the handshake has completed.
Encrypts a transport payload once the handshake has completed.
Processes the server hello frame and returns the client finish frame together with the updated Noise state (now ready for transport encryption/decryption).
Initialises a new Noise handshake state.
Types
@type t() :: %ExWapp.Noise{ certificate_verifier: certificate_verifier_fun() | nil, cipher_ref: term() | nil, client_payload_fun: nil | (t() -> binary() | {:ok, binary()} | {:error, term()} | {:ok, binary(), ExWapp.Store.data()}), handshake_hash: binary() | nil, handshake_header: binary(), handshake_ref: term() | nil, handshake_salt: binary() | nil, pending_store_data: ExWapp.Store.data() | nil, phase: :handshake | :transport, rx_counter: non_neg_integer(), rx_key: binary() | nil, static_key: %{priv: binary(), pub: binary()} | nil, store: ExWapp.Store.t() | nil, tx_counter: non_neg_integer(), tx_key: binary() | nil }
Functions
Decrypts a transport payload once the handshake has completed.
Encrypts a transport payload once the handshake has completed.
Processes the server hello frame and returns the client finish frame together with the updated Noise state (now ready for transport encryption/decryption).
Initialises a new Noise handshake state.
Returns the binary client hello frame that must be sent immediately together with the updated state.