A tiny, dependency-free UUID v4 generator.
Moov requires an X-Idempotency-Key header on transfer-creation calls (and
accepts one on several other write endpoints) to safely deduplicate retried
requests. Rather than pull in an external UUID library for this one need,
Moov.Client generates RFC 4122 version 4 UUIDs using only :crypto from
Erlang/OTP, which is always available.
Summary
Functions
Generates a random version 4 (random) UUID as a lowercase, hyphenated
string, e.g. "d6903402-776f-48d6-8fba-0358959d34e5".
Functions
@spec generate() :: String.t()
Generates a random version 4 (random) UUID as a lowercase, hyphenated
string, e.g. "d6903402-776f-48d6-8fba-0358959d34e5".
Examples
iex> uuid = Moov.UUID.generate()
iex> String.match?(uuid, ~r/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)
true