Crosswake.Policy.Schema (crosswake v0.1.2)

View Source

NimbleOptions schema for Phase 1 Crosswake route policy declarations.

Summary

Types

auth_posture()

@type auth_posture() :: :strict_recent | :remembered_ok | :cached_read_only_ok

auth_return_declaration()

@type auth_return_declaration() :: %{
  kind: auth_return_kind() | nil,
  transport: auth_return_transport() | nil,
  return_route_id: String.t() | nil,
  validates: [auth_return_validation()]
}

auth_return_kind()

@type auth_return_kind() :: :oauth | :passkey | :native_auth

auth_return_transport()

@type auth_return_transport() ::
  :http_callback | :verified_https_link | :custom_scheme | :bridge_event

auth_return_validation()

@type auth_return_validation() ::
  :state
  | :nonce
  | :pkce
  | :redirect_uri
  | :link_verification
  | :expiry
  | :replay
  | :challenge
  | :origin
  | :rp_id
  | :user_verification
  | :callback_binding

commerce_declaration()

@type commerce_declaration() :: %{
  corridor: String.t() | nil,
  role: commerce_role() | nil
}

commerce_role()

@type commerce_role() ::
  :paywall_entry | :purchase_intent | :restore_intent | :account_management

entry()

@type entry() :: :internal_only | :external

notification_open_declaration()

@type notification_open_declaration() :: true | %{actions: [atom()]}

offline()

@type offline() :: :unavailable | :cached_read_only | :local_first

pack_integrity()

@type pack_integrity() :: %{algorithm: String.t(), digest: String.t()}

pack_kind()

@type pack_kind() :: :content | :media

pack_requirement()

@type pack_requirement() :: Crosswake.Offline.ContentPack.t()

runtime()

@type runtime() :: :live_view | :offline_island | :native_screen

security()

@type security() :: :standard | :sensitive

validated_options()

@type validated_options() :: [
  id: String.t(),
  runtime: runtime(),
  offline: offline(),
  entry: entry(),
  cache_contract: String.t() | nil,
  island_contract: String.t() | nil,
  capabilities: [String.t()],
  commerce: commerce_declaration() | nil,
  packs: [pack_requirement()],
  sync: [String.t()],
  transfers: [Crosswake.Transfer.Contracts.declaration()],
  security: security(),
  gated_by: atom() | nil,
  on_unavailable: :deny | {:fallback_phoenix, atom()} | nil,
  auth_min_level: atom() | nil,
  requires_recent_auth: pos_integer() | nil,
  auth_posture: auth_posture() | nil,
  auth_return: auth_return_declaration() | nil,
  notification_open: notification_open_declaration() | nil
]

Functions

auth_posture_values()

@spec auth_posture_values() :: [auth_posture()]

auth_return_kind_values()

@spec auth_return_kind_values() :: [auth_return_kind()]

auth_return_transport_values()

@spec auth_return_transport_values() :: [auth_return_transport()]

commerce_role_values()

@spec commerce_role_values() :: [commerce_role()]

schema()

@spec schema() :: NimbleOptions.t()

validate(options)

@spec validate(keyword()) ::
  {:ok, validated_options()} | {:error, NimbleOptions.ValidationError.t()}

validate!(options)

@spec validate!(keyword()) :: validated_options()

validate_auth_min_level(value)

@spec validate_auth_min_level(term()) :: {:ok, atom() | nil} | {:error, String.t()}

validate_auth_return_declaration(declaration)

@spec validate_auth_return_declaration(term()) ::
  {:ok, auth_return_declaration() | nil} | {:error, String.t()}

validate_commerce_declaration(declaration)

@spec validate_commerce_declaration(term()) ::
  {:ok, commerce_declaration() | nil} | {:error, String.t()}

validate_flag_key(value)

@spec validate_flag_key(term()) :: {:ok, atom()} | {:error, String.t()}

validate_identifier(value)

@spec validate_identifier(term()) :: {:ok, String.t()} | {:error, String.t()}

validate_notification_open(declaration)

@spec validate_notification_open(term()) ::
  {:ok, true | %{actions: [atom()]} | nil} | {:error, String.t()}

validate_on_unavailable(value)

@spec validate_on_unavailable(term()) ::
  {:ok, :deny | {:fallback_phoenix, atom()} | nil} | {:error, String.t()}

validate_pack_requirements(requirements)

@spec validate_pack_requirements(term()) ::
  {:ok, [pack_requirement()]} | {:error, String.t()}

validate_requires_recent_auth(value)

@spec validate_requires_recent_auth(term()) ::
  {:ok, pos_integer() | nil} | {:error, String.t()}

validate_runtime(value)

@spec validate_runtime(term()) :: {:ok, runtime()} | {:error, String.t()}

validate_transfer_declarations(declarations)

@spec validate_transfer_declarations(term()) ::
  {:ok, [Crosswake.Transfer.Contracts.declaration()]} | {:error, String.t()}