# `AttestoClient.AuthorizationTransaction.Store`
[🔗](https://github.com/XukuLLC/attesto_client/blob/v2.26.0/lib/attesto_client/authorization_transaction/store.ex#L1)

Storage contract for replay-safe authorization transactions.

Both callbacks must be atomic. `put_new/4` must never replace a live entry,
and `take/2` must delete before returning so the same state cannot be used
twice, including under concurrent callbacks. `ttl_ms` is a relative lifetime
in milliseconds.

A store is represented as `{module, handle}`. The included
`AttestoClient.AuthorizationTransaction.Store.ETS` implementation uses a
supervised process as the handle.

# `handle`

```elixir
@type handle() :: term()
```

# `store`

```elixir
@type store() :: {module(), handle()}
```

# `put_new`

```elixir
@callback put_new(
  handle(),
  String.t(),
  AttestoClient.AuthorizationTransaction.t(),
  pos_integer()
) ::
  :ok | {:error, :already_exists | term()}
```

# `take`

```elixir
@callback take(handle(), String.t()) ::
  {:ok, AttestoClient.AuthorizationTransaction.t()}
  | {:error, :not_found | :expired | term()}
```

---

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