Transport-neutral challenge selection and ordering.
HTTP (MPP.Client.Req) and MCP client orchestration share this policy so
challenge ranking is not owned by any one wire transport. The default
preserves server-advertised order — first MultiProvider-supported challenge
wins — matching mppx client orchestration and the mpp-rs provider default
(select_challenge keeps caller order).
Policies
:server_order— keep the server's offer order (default){:accept_payment, entries}— reorder byAccept-Paymentpreferences- an arity-1 function — receives the supported challenges and returns them filtered/reordered; the first remaining challenge is selected
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
select | 3 | Pick a challenge using a selection policy and MultiProvider support. | challenges: value, multi: value, policy: value |
default | 0 | Return the default policy (:server_order). | - |
Summary
Functions
Return the default policy (:server_order).
Pick one supported challenge according to policy.
Types
@type t() :: :server_order | {:accept_payment, [MPP.AcceptPayment.entry()]} | ([MPP.Challenge.t()] -> [MPP.Challenge.t()])
Functions
@spec default() :: :server_order
Return the default policy (:server_order).
@spec select([MPP.Challenge.t()], MPP.Client.MultiProvider.t(), t()) :: {:ok, MPP.Challenge.t()} | {:error, :no_supported_challenge}
Pick one supported challenge according to policy.
Unsupported challenges are dropped first. The policy then orders what remains
and the first entry is selected. Returns {:error, :no_supported_challenge}
when nothing is left, including the empty-list case.