Amarula.Protocol.Auth.BaileysCredentialLoader (amarula v0.1.0)

View Source

Utility to load Baileys-formatted credentials into Amarula format.

This allows testing Amarula with the exact same credentials that work in Baileys.

Summary

Functions

Convert Baileys credential format to Amarula format.

Load credentials from a Baileys creds.json file.

Functions

convert_to_amarula_format(baileys_creds)

@spec convert_to_amarula_format(map()) ::
  {:ok, Amarula.Protocol.Auth.Types.auth_creds()}

Convert Baileys credential format to Amarula format.

Baileys format uses Buffer wrapper objects: {"type": "Buffer", "data": "base64"} Amarula format uses raw binaries.

load_from_file(file_path)

@spec load_from_file(String.t()) ::
  {:ok, Amarula.Protocol.Auth.Types.auth_creds()} | {:error, term()}

Load credentials from a Baileys creds.json file.

Returns credentials in Amarula's internal format.