# `PhoenixMicro.Utils.ID`
[🔗](https://github.com/iamkanishka/phoenix_micro/blob/v1.0.0/lib/phoenix_micro/utils/id.ex#L1)

UUID v4 generation and correlation ID utilities.

Provides a dependency-free UUID v4 generator using `:crypto.strong_rand_bytes/1`
and a short correlation ID format suitable for log tracing.

# `correlation_id`

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

Generates a short correlation ID (16 hex chars) for use in log tracing.

Shorter than a full UUID — suitable for HTTP headers and log fields.

## Example

    iex> PhoenixMicro.Utils.ID.correlation_id()
    "a3f2e1b4c8d9e0f1"

# `uuid4`

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

Generates a RFC 4122 UUID v4 string.

Uses `:crypto.strong_rand_bytes/1` — no external dependencies.

## Example

    iex> PhoenixMicro.Utils.ID.uuid4()
    "550e8400-e29b-41d4-a716-446655440000"

# `valid_uuid?`

```elixir
@spec valid_uuid?(String.t()) :: boolean()
```

Returns true if the given string is a valid UUID v4.

## Example

    iex> PhoenixMicro.Utils.ID.valid_uuid?("550e8400-e29b-41d4-a716-446655440000")
    true

---

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