# `Wise.Internal.Retry`
[🔗](https://github.com/iamkanishka/wise/blob/v1.0.0/lib/wise/internal/retry.ex#L1)

Exponential back-off retry with full jitter.

Uses `:crypto.strong_rand_bytes/1` for cryptographically safe jitter.
Retries on HTTP 429 and 5xx. Does not retry 4xx (except 429).

# `opts`

```elixir
@type opts() :: %{
  max_retries: non_neg_integer(),
  base_delay_ms: pos_integer(),
  max_delay_ms: pos_integer()
}
```

# `with_retry`

```elixir
@spec with_retry(
  (non_neg_integer() -&gt; {:ok, any()} | {:error, Wise.Error.t()}),
  opts()
) ::
  {:ok, any()} | {:error, Wise.Error.t()}
```

Executes `fun` with retry logic.

`fun` must return `{:ok, result}` or `{:error, Wise.Error.t()}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
