AshAuthentication.BankID.UserMessages (ash_authentication_bankid v0.1.3)

View Source

User-facing messages for BankID authentication in multiple languages.

Provides translations for UI text and hint codes based on BankID's recommended user messages. Supports Swedish (:sv) and English (:en).

Usage

iex> UserMessages.hint_message("outstandingTransaction", :en)
"Starting BankID..."

iex> UserMessages.hint_message("userCancel", :sv)
"Åtgärden avbröts."

iex> UserMessages.ui_text(:title, :en)
"Start the BankID app"

Summary

Functions

Get translated message for a BankID hint code.

Get timeout message with the number of minutes.

Get translated UI text for the BankID authentication page.

Types

hint_code()

@type hint_code() :: String.t()

locale()

@type locale() :: :en | :sv

ui_key()

@type ui_key() :: atom()

Functions

hint_message(hint_code, locale \\ :en)

@spec hint_message(hint_code(), locale()) :: String.t()

Get translated message for a BankID hint code.

Parameters

  • hint_code - The hint code from BankID API (e.g., "outstandingTransaction")
  • locale - Language locale (:en or :sv, defaults to :en)

Examples

iex> hint_message("started", :en)
"BankID app opened. Please complete authentication."

iex> hint_message("userCancel", :sv)
"Åtgärden avbröts."

timeout_message(minutes, locale \\ :en)

@spec timeout_message(integer(), locale()) :: String.t()

Get timeout message with the number of minutes.

Parameters

  • minutes - Number of minutes for timeout
  • locale - Language locale (:en or :sv, defaults to :en)

Examples

iex> timeout_message(5, :en)
"Authentication timed out after 5 minutes"

iex> timeout_message(1, :sv)
"Autentiseringen avbröts efter 1 minut"

ui_text(key, locale \\ :en)

@spec ui_text(ui_key(), locale()) :: String.t()

Get translated UI text for the BankID authentication page.

Parameters

  • key - The UI element key (atom)
  • locale - Language locale (:en or :sv, defaults to :en)

Examples

iex> ui_text(:title, :en)
"Start the BankID app"

iex> ui_text(:title, :sv)
"Starta BankID-appen"