Amarula.Protocol.Auth.CompanionReg (amarula v0.1.0)
View SourceHelpers for the link-code (phone-number) pairing flow.
Currently this is the Crockford base32 encoder used to mint the 8-character
pairing code from 5 random bytes — a faithful port of Baileys bytesToCrockford
(src/Utils/generics.ts). The companion platform-id table lives in
Amarula.Connection (companion_platform_id/1), reused by both QR and
link-code pairing.
Summary
Functions
Encode a binary as a Crockford base32 string.
Functions
Encode a binary as a Crockford base32 string.
Groups the input MSB-first into 5-bit chunks; a trailing partial chunk is
left-padded (shifted up) to a full 5 bits. Mirrors Baileys bytesToCrockford.
iex> Amarula.Protocol.Auth.CompanionReg.crockford_encode(<<0, 1, 2, 3, 4>>)
"111H51R5"