BaileysEx.Syncd.Keys (baileys_ex v0.1.0-alpha.8)

Copy Markdown View Source

App state sync key expansion.

Expands raw 32-byte key material into five derived keys used by the Syncd protocol for index signing, value encryption, value MAC, snapshot MAC, and patch MAC operations.

Ports expandAppStateKeys + mutationKeys from chat-utils.ts:34-43.

Summary

Functions

Expand raw key material into five Syncd subkeys via HKDF-SHA256.

Types

t()

@type t() :: %{
  index_key: <<_::256>>,
  value_encryption_key: <<_::256>>,
  value_mac_key: <<_::256>>,
  snapshot_mac_key: <<_::256>>,
  patch_mac_key: <<_::256>>
}

Functions

expand_app_state_keys(key_data)

@spec expand_app_state_keys(binary()) :: t()

Expand raw key material into five Syncd subkeys via HKDF-SHA256.

Equivalent to Baileys expandAppStateKeys(keydata) from whatsapp-rust-bridge.

Parameters

  • key_data — 32-byte raw app state sync key material

Returns

Map with five 32-byte keys: :index_key, :value_encryption_key, :value_mac_key, :snapshot_mac_key, :patch_mac_key.

mutation_keys(key_data)

@spec mutation_keys(binary()) :: t()

Alias for expand_app_state_keys/1.

Ports mutationKeys(keydata) from chat-utils.ts:34.