README.md
# UXID
UXIDs are identifiers which:
* describe the resource (to help in debugging and investigation)
* work well with copy and paste (double clicking should select the entire ID)
* can be shortened for low cardinality resources
* are very unlikely to collide
* are secure against enumeration attacks
* can be generated by application code (not tied to the datastore)
* are K-sortable (lexicographically sortable by time - works well with datastore indexing)
* do not require any coordination (human or automated) at startup, or generation
Many of the concepts of Stripe IDs have been used in this library.
## Usage
```elixir
# No options generates a basic ULID
UXID.generate! # "01EMDGJF0DQXQJ8FM78XE97Y3H"
# A prefix can be provided
UXID.generate! prefix: "cus" # "cus_01EMDGJF0DQXQJ8FM78XE97Y3H"
# The amount of randomness can be decreased for smaller cardinality resources
UXID.generate! prefix: "cus", rand_size: 4 # "cus_01EMDGN5QAGPWSKN2"
```
## Installation
The package can be installed by adding `uxid` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:uxid, "~> 0.0.2"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) and published on [HexDocs](https://hexdocs.pm).
Once published, the docs can be found at [https://hexdocs.pm/uxid](https://hexdocs.pm/uxid).