# `NativeArtifact.Manifest`
[🔗](https://github.com/gsmlg-dev/native_artifact/blob/main/lib/native_artifact/manifest.ex#L1)

Bounded, fail-closed validation of pinned Manifest v1 metadata.

`decode/2` rejects duplicate JSON object keys before validating the schema and
cross-references. `validate/2` accepts already-decoded string-keyed JSON data.
Both return `%Manifest{data: original_data}` without creating atoms from input.
Validation performs no I/O and does not prove that an archive exists, its bytes
match, or its native code is compatible with a running system.

Options are positive integer limits: `:max_manifest_bytes` (4 MiB),
`:max_depth` (64 container levels), `:max_nodes` (100,000 values/object keys),
`:max_artifacts` (128), `:max_files` (4,096 across the manifest),
`:max_archive_bytes` (256 MiB per archive), and `:max_unpacked_bytes`
(1 GiB across the manifest). For `validate/2`, the byte limit applies to the
compact JSON representation; `decode/2` also bounds the original input bytes.

# `t`

```elixir
@type t() :: %NativeArtifact.Manifest{data: %{required(String.t()) =&gt; term()}}
```

# `decode`

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

Decodes bounded UTF-8 JSON, rejecting duplicate object keys and invalid v1 metadata.

# `validate`

```elixir
@spec validate(term(), keyword()) :: {:ok, t()} | {:error, NativeArtifact.Error.t()}
```

Validates string-keyed JSON data without normalizing it or performing I/O.

---

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