Amarula.Protocol.AppState.Keys (amarula v0.1.0)

View Source

Expand an app-state-sync key into the five mutation sub-keys, ported from Baileys mutationKeys/expandAppStateKeys (pre-WASM chat-utils.ts):

HKDF(key_data, 160, salt="", info="WhatsApp Mutation Keys")

sliced into 5 × 32 bytes, in order:

  • index_key — HMAC the record index
  • value_encryption_key — AES-256-CBC the record value
  • value_mac_key — HMAC (SHA-512) the value MAC
  • snapshot_mac_key — HMAC the snapshot (LTHash) MAC
  • patch_mac_key — HMAC the patch MAC

Summary

Functions

Expand the 32-byte app-state-sync key_data into the five sub-keys.

Types

t()

@type t() :: %{
  index_key: binary(),
  value_encryption_key: binary(),
  value_mac_key: binary(),
  snapshot_mac_key: binary(),
  patch_mac_key: binary()
}

Functions

expand(key_data)

@spec expand(binary()) :: t()

Expand the 32-byte app-state-sync key_data into the five sub-keys.