# `SmolBox.Store.Codec`
[🔗](https://github.com/hfiguera/smolbox/blob/v0.1.2/lib/smolbox/store/codec.ex#L1)

Versioned data-only record encoding for trusted host store adapters.

This is an internal persistence format, never an endpoint for guest or public
input. Records are validated before encoding and after safe decoding. Compressed
terms, trailing bytes, unknown schemas, unexpected structs/keys, PIDs, refs,
ports, and closures are rejected. Payloads have a fixed 16 MiB cap.

Encoding does not encrypt secrets. Durable adapters must authenticate and encrypt
these bytes or use an explicitly approved equivalent secure storage policy.
Schema upgrades require a host migration; silently treating undecodable records
as absent would permit replay and is forbidden.

# `decode`

```elixir
@spec decode(binary()) :: {:ok, SmolBox.Execution.t()} | {:error, SmolBox.Error.t()}
```

# `encode`

```elixir
@spec encode(SmolBox.Execution.t()) :: {:ok, binary()} | {:error, SmolBox.Error.t()}
```

---

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