Amarula.Protocol.Auth.QRCodeGenerator (amarula v0.1.0)
View SourceQR Code Generator for WhatsApp authentication.
This module provides utilities for generating QR codes from authentication data and handling QR code formatting and validation.
Summary
Functions
Extracts the advertisement secret key from a QR code string.
Extracts the identity key from a QR code string.
Extracts the noise key from a QR code string.
Extracts the reference from a QR code string.
Formats a QR code for display (e.g., in terminal or UI).
Convenience function that generates a QR string and renders it as terminal output.
Generates a QR code string from authentication components.
Generates a QR code reference string.
Generates multiple QR code references.
Parses a QR code string into its components.
Checks if a QR code has expired based on its generation time.
Renders a QR string as ASCII art using the qr_code library.
Renders a QR string with pretty terminal formatting including borders and branding.
Validates a QR code string format.
Functions
Extracts the advertisement secret key from a QR code string.
Extracts the identity key from a QR code string.
Extracts the noise key from a QR code string.
Extracts the reference from a QR code string.
Formats a QR code for display (e.g., in terminal or UI).
@spec generate_and_render(String.t(), String.t(), String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}
Convenience function that generates a QR string and renders it as terminal output.
Takes authentication components and returns a formatted ASCII QR code.
Generates a QR code string from authentication components.
The QR code format is: "ref,noiseKeyB64,identityKeyB64,advSecretKeyB64"
@spec generate_ref() :: String.t()
Generates a QR code reference string.
This creates a unique reference string for QR code generation.
Generates multiple QR code references.
@spec parse_qr_string(String.t()) :: {:ok, {String.t(), String.t(), String.t(), String.t()}} | {:error, String.t()}
Parses a QR code string into its components.
Returns {:ok, {ref, noise_key_b64, identity_key_b64, adv_secret_key_b64}} on success, or {:error, reason} on failure.
Checks if a QR code has expired based on its generation time.
Renders a QR string as ASCII art using the qr_code library.
Takes a QR string and returns an ASCII representation of the QR code matrix. Uses half-height blocks to correct for terminal character aspect ratio.
Renders a QR string with pretty terminal formatting including borders and branding.
Takes a QR string and returns a formatted ASCII QR code suitable for terminal display.
Validates a QR code string format.