AshAuthentication.BankID.OrderResource (ash_authentication_bankid v0.1.3)

View Source

Ash Resource extension for BankID order tracking.

This extension adds all necessary attributes and actions to a resource for tracking BankID authentication orders.

Usage

Add this extension to your order resource:

defmodule MyApp.Accounts.BankIDOrder do
  use Ash.Resource,
    domain: MyApp.Accounts,
    data_layer: AshPostgres.DataLayer,
    extensions: [AshAuthentication.BankID.OrderResource]

  postgres do
    table "bankid_orders"
    repo MyApp.Repo
  end
end

This will automatically add:

  • All required attributes (order_ref, qr tokens, session info, etc.)
  • CRUD actions (create, read, update, destroy)
  • Identity on order_ref
  • Timestamps

Attributes Added

  • id - UUID primary key
  • order_ref - String (unique, BankID order reference)
  • qr_start_token - String (public QR token)
  • qr_start_secret - String (QR secret, sensitive)
  • auto_start_token - String (same-device token)
  • start_t - Integer (Unix timestamp)
  • session_id - String (Phoenix session binding)
  • ip_address - String (user IP)
  • status - String (pending/complete/failed)
  • hint_code - String (BankID hint code, nullable)
  • completion_data - Map (BankID completion data, nullable)
  • consumed - Boolean (prevents reuse)
  • tenant - String (tenant identifier for multi-tenant apps, nullable)
  • inserted_at - DateTime
  • updated_at - DateTime

Migration

After adding this extension, generate a migration:

mix ash.codegen create_bankid_orders