# `AshAuthentication.Strategy.Otp.DefaultGenerator`
[🔗](https://github.com/team-alembic/ash_authentication/blob/main/lib/ash_authentication/strategies/otp/default_generator.ex#L5)

Default OTP code generator.

Generates random codes from a configurable character set and length.
Also provides `normalize/1` for case-insensitive matching.

Ambiguous characters are excluded to avoid confusion when users read
and type codes:

- Letters removed: `I` (looks like `1`/`l`), `L` (looks like `1`/`I`),
  `O` (looks like `0`), `S` (looks like `5`), `Z` (looks like `2`)
- Digits removed: `0` (looks like `O`), `1` (looks like `I`/`l`),
  `2` (looks like `Z`), `5` (looks like `S`)

# `generate`

```elixir
@spec generate(keyword()) :: String.t()
```

Generate a random OTP code.

Options:
  * `:length` - the length of the code (default: 6)
  * `:characters` - the character set to use (default: `:unambiguous_uppercase`)
    Supported values: `:unambiguous_uppercase`, `:unambiguous_alphanumeric`, `:digits_only`, `:uppercase_letters_only`

# `normalize`

```elixir
@spec normalize(String.t()) :: String.t()
```

Normalize an OTP code for comparison.

Trims whitespace and converts to uppercase.

---

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