# `OCSF.UUID`
[🔗](https://github.com/docjerem/ocsf/blob/v0.1.0/lib/ocsf/uuid.ex#L1)

UUIDv7 helpers.

Delegates to the `uuid_v7` library which provides a compliant
implementation with an 18-bit randomly-seeded counter for
sub-millisecond ordering. Used to generate unique identifiers for
OCSF event metadata.

See `OCSF.Metadata` for how generated UUIDs are used.

# `v7`

```elixir
@spec v7() :: &lt;&lt;_::128&gt;&gt;
```

Generate a UUIDv7 as a 16-byte raw binary.

## Examples

    iex> raw = OCSF.UUID.v7()
    iex> byte_size(raw)
    16

# `v7_string`

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

Generate a UUIDv7 as a lowercase hex string with dashes.

## Examples

    iex> uuid = OCSF.UUID.v7_string()
    iex> String.match?(uuid, ~r/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)
    true

---

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