ar-io-proof 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. ar_io_proof-0.1.0/.github/workflows/ci.yml +24 -0
  2. ar_io_proof-0.1.0/.github/workflows/release.yml +45 -0
  3. ar_io_proof-0.1.0/.gitignore +7 -0
  4. ar_io_proof-0.1.0/CLAUDE.md +64 -0
  5. ar_io_proof-0.1.0/LICENSE +21 -0
  6. ar_io_proof-0.1.0/PKG-INFO +185 -0
  7. ar_io_proof-0.1.0/README.md +138 -0
  8. ar_io_proof-0.1.0/pyproject.toml +47 -0
  9. ar_io_proof-0.1.0/src/ario_proof/__init__.py +60 -0
  10. ar_io_proof-0.1.0/src/ario_proof/bundle.py +131 -0
  11. ar_io_proof-0.1.0/src/ario_proof/canonicalize.py +36 -0
  12. ar_io_proof-0.1.0/src/ario_proof/envelope.py +283 -0
  13. ar_io_proof-0.1.0/src/ario_proof/hash.py +15 -0
  14. ar_io_proof-0.1.0/src/ario_proof/merkle.py +123 -0
  15. ar_io_proof-0.1.0/src/ario_proof/sign.py +36 -0
  16. ar_io_proof-0.1.0/src/ario_proof/verify.py +24 -0
  17. ar_io_proof-0.1.0/test-vectors/CORPUS-v1.md +36 -0
  18. ar_io_proof-0.1.0/test-vectors/README.md +25 -0
  19. ar_io_proof-0.1.0/test-vectors/VENDORING.md +25 -0
  20. ar_io_proof-0.1.0/test-vectors/envelope-asset-missing-01.json +45 -0
  21. ar_io_proof-0.1.0/test-vectors/envelope-asset-registered-01.json +41 -0
  22. ar_io_proof-0.1.0/test-vectors/envelope-key-retired-01.json +37 -0
  23. ar_io_proof-0.1.0/test-vectors/envelope-policy-changed-01.json +40 -0
  24. ar_io_proof-0.1.0/test-vectors/envelope-tamper-detected-01.json +48 -0
  25. ar_io_proof-0.1.0/test-vectors/envelope-verification-checkpoint-01.json +50 -0
  26. ar_io_proof-0.1.0/test-vectors/merkle-tree-00-leaves.json +8 -0
  27. ar_io_proof-0.1.0/test-vectors/merkle-tree-01-leaves.json +31 -0
  28. ar_io_proof-0.1.0/test-vectors/merkle-tree-02-leaves.json +56 -0
  29. ar_io_proof-0.1.0/test-vectors/merkle-tree-03-leaves.json +81 -0
  30. ar_io_proof-0.1.0/test-vectors/merkle-tree-07-leaves.json +152 -0
  31. ar_io_proof-0.1.0/test-vectors/merkle-tree-1024-leaves.json +17463 -0
  32. ar_io_proof-0.1.0/test-vectors/merkle-tree-16-leaves.json +309 -0
  33. ar_io_proof-0.1.0/tests/test_bundle.py +175 -0
  34. ar_io_proof-0.1.0/tests/test_canonicalize.py +45 -0
  35. ar_io_proof-0.1.0/tests/test_conformance.py +269 -0
  36. ar_io_proof-0.1.0/tests/test_envelope.py +326 -0
  37. ar_io_proof-0.1.0/tests/test_hash.py +18 -0
  38. ar_io_proof-0.1.0/tests/test_merkle.py +89 -0
  39. ar_io_proof-0.1.0/tests/test_sign_verify.py +60 -0
@@ -0,0 +1,24 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.10", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: pip install -e .[dev]
21
+ - name: Format check
22
+ run: black --check src tests
23
+ - name: Conformance + unit tests
24
+ run: pytest -q
@@ -0,0 +1,45 @@
1
+ name: release
2
+
3
+ # Publishes to PyPI via Trusted Publishing (OIDC) — no token secrets.
4
+ # Trigger: a maintainer pushes a v* tag (e.g. `git tag v0.1.0 && git push origin v0.1.0`).
5
+ # One-time setup on pypi.org: add a "pending publisher" for project ar-io-proof
6
+ # with owner=ar-io, repo=ar-io-proof, workflow=release.yml, environment=pypi.
7
+
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Run the conformance gate before anything ships
21
+ run: |
22
+ pip install -e .[dev]
23
+ black --check src tests
24
+ pytest -q
25
+ - name: Build sdist + wheel
26
+ run: |
27
+ pip install build
28
+ python -m build
29
+ - uses: actions/upload-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+
34
+ publish:
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ environment: pypi
38
+ permissions:
39
+ id-token: write
40
+ steps:
41
+ - uses: actions/download-artifact@v4
42
+ with:
43
+ name: dist
44
+ path: dist/
45
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
@@ -0,0 +1,64 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## What this is
6
+
7
+ `ar-io-proof` (import: `ario_proof`) — the standalone Python verification kernel of the ar.io
8
+ verification stack, extracted from `ar-io-mlflow`'s proof engine. It implements exactly the five
9
+ kernel primitives from `ar-io-agent/docs/stack/architecture.md` §3: RFC 8785 (JCS)
10
+ canonicalization, SHA-256, Ed25519 sign/verify, RFC 9162 binary Merkle (incl. inclusion-proof
11
+ bundles), and the accepted-`spec_version` registry. **No I/O, no networking, no key lifecycle** —
12
+ those belong to producers (`ar-io-agent`, `ar-io-mlflow`), not the kernel.
13
+
14
+ ## Commands
15
+
16
+ ```bash
17
+ python3 -m venv .venv && .venv/bin/pip install -e .[dev] # one-time setup
18
+ .venv/bin/pytest -q # all tests (conformance is the contract)
19
+ .venv/bin/pytest tests/test_conformance.py -q # corpus gate only
20
+ .venv/bin/black src tests # format (CI runs black --check)
21
+ ```
22
+
23
+ ## The conformance contract
24
+
25
+ `test-vectors/` is a byte-for-byte vendored copy of `ar-io-agent/test-vectors/` at tag
26
+ **`test-vectors-v1.0`** (provenance: `test-vectors/VENDORING.md`). `tests/test_conformance.py`
27
+ asserts, for every vector: SHA-256 corpus integrity against the CORPUS-v1.md table, JCS-canonical
28
+ payload bytes, `payload_hash`, envelope-for-signature bytes, deterministic Ed25519 signatures, and
29
+ Merkle roots / audit paths. **If the kernel disagrees with a vector, the kernel is wrong — never
30
+ the vector.** Never edit vector files; re-sync only at a published corpus tag per
31
+ `VENDORING.md`.
32
+
33
+ ## Spec pins (do not drift)
34
+
35
+ - `envelope-spec.md` **v1.1 (ratified v1.0 2026-06-10, amended 2026-06-11 — additive, same
36
+ corpus tag)** — the family contract. Profiles accepted: `ario.agent/v1` (inline payload) and
37
+ `ario.mlflow/v1` (external commitment). Fail-closed on unknown majors.
38
+ - Signed scope = the envelope minus **`signature`**, minus the reserved **`co_signatures`**
39
+ (envelope-spec §7.1), and — **profile-conditional** — minus underscore-prefixed annotation
40
+ keys for `ario.mlflow/v1` + legacy envelopes ONLY (mlflow convention, e.g. `_tx_id`). The
41
+ `ario.agent/v1` scope is minus-signature/co_signatures only, matching Go: an injected `_*`
42
+ key on an agent envelope MUST fail verification. The corpus can catch neither the
43
+ co_signatures strip nor the profile-conditionality — unit tests in `tests/test_envelope.py`
44
+ are the only guard; do not remove them because conformance still passes without them.
45
+ - Merkle: RFC 9162 §2.1 domain separation (`0x00` leaf / `0x01` node), empty-tree root =
46
+ `SHA-256("")`. Never the Bitcoin duplicate-last-leaf variant.
47
+ - Ed25519 is strict RFC 8032 (libsodium via PyNaCl) — matches Go `crypto/ed25519` and the JS
48
+ sibling's `zip215: false`.
49
+
50
+ ## Working rules
51
+
52
+ - Verifiers must never raise on adversarial input — malformed envelopes return a failed
53
+ `VerificationResult`, they don't throw.
54
+ - Each commit lands one primitive, CI-green, with tests in the same commit.
55
+ - Dependencies are pinned to two load-bearing packages: `PyNaCl` and `jcs`. Adding a dependency
56
+ is a design decision, not a convenience.
57
+ - Source siblings for cross-checks (read-only): Go reference `ar-io-agent/internal/{proof,merkle}`,
58
+ JS verifier `ar-io-proof-checker/src/{crypto,verifier}.ts`, origin kernel
59
+ `ar-io-mlflow/ario_mlflow/proof.py`.
60
+
61
+ ## Release
62
+
63
+ `release.yml` publishes to PyPI via Trusted Publishing (OIDC) on a `v*` tag pushed by a
64
+ maintainer. Version lives in `pyproject.toml` + `src/ario_proof/__init__.py`; bump both together.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ar.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: ar-io-proof
3
+ Version: 0.1.0
4
+ Summary: Verification kernel for the ar.io verification stack: RFC 8785 canonicalization, SHA-256, Ed25519 envelope sign/verify, RFC 9162 Merkle inclusion proofs.
5
+ Project-URL: Repository, https://github.com/ar-io/ar-io-proof
6
+ Project-URL: Issues, https://github.com/ar-io/ar-io-proof/issues
7
+ Author: ar.io
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 ar.io
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: ar.io,arweave,ed25519,jcs,merkle,provenance,rfc8785,rfc9162,verification
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python :: 3
35
+ Classifier: Programming Language :: Python :: 3.10
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Topic :: Security :: Cryptography
40
+ Requires-Python: >=3.10
41
+ Requires-Dist: jcs>=0.2.1
42
+ Requires-Dist: pynacl>=1.5.0
43
+ Provides-Extra: dev
44
+ Requires-Dist: black>=24.0; extra == 'dev'
45
+ Requires-Dist: pytest>=7.0; extra == 'dev'
46
+ Description-Content-Type: text/markdown
47
+
48
+ # ar-io-proof
49
+
50
+ Verification kernel for the [ar.io verification stack](https://github.com/ar-io): RFC 8785
51
+ (JCS) canonicalization, SHA-256 hashing, Ed25519 envelope sign/verify, and RFC 9162 binary
52
+ Merkle inclusion proofs — as a standalone, dependency-light Python package.
53
+
54
+ ```bash
55
+ pip install ar-io-proof
56
+ ```
57
+
58
+ ## Quickstart
59
+
60
+ Verify a signed envelope fetched from any Arweave gateway:
61
+
62
+ ```python
63
+ import json
64
+ import urllib.request
65
+
66
+ from ario_proof import verify_envelope
67
+
68
+ raw = urllib.request.urlopen("https://arweave.net/raw/<tx_id>").read()
69
+ result = verify_envelope(json.loads(raw))
70
+
71
+ assert result.ok # spec_version + payload binding + Ed25519 signature
72
+ print(result.to_dict())
73
+ ```
74
+
75
+ Bind an artifact you hold to the provenance an envelope commits to (reverse lookup):
76
+
77
+ ```python
78
+ import hashlib
79
+
80
+ artifact_hash = hashlib.sha256(open("model.pkl", "rb").read()).hexdigest()
81
+ result = verify_envelope(envelope, expected_content_hash=artifact_hash)
82
+ print(result.content_hash_ok, result.content_role) # True, "asset"
83
+ ```
84
+
85
+ Verify an external-commitment (`ario.mlflow/v1`) envelope against the committed bytes:
86
+
87
+ ```python
88
+ result = verify_envelope(envelope, payload_bytes=canonical_bytes)
89
+ ```
90
+
91
+ Verify an inclusion-proof bundle (`ariod proof` output — proves a leaf was in a signed
92
+ daily checkpoint):
93
+
94
+ ```python
95
+ from ario_proof import verify_proof_bundle
96
+
97
+ bundle = json.load(open("proof-bundle.json"))
98
+ result = verify_proof_bundle(bundle)
99
+ assert result.ok and result.inclusion_ok
100
+ ```
101
+
102
+ Sign an envelope (producers):
103
+
104
+ ```python
105
+ from ario_proof import sign_envelope, signing_key_from_seed_hex
106
+
107
+ key = signing_key_from_seed_hex("<32-byte seed hex>")
108
+ envelope = sign_envelope(
109
+ {
110
+ "spec_version": "ario.mlflow/v1",
111
+ "event_id": "...",
112
+ "event_type": "training_complete",
113
+ "subject": {"type": "mlflow_run", "run_id": "..."},
114
+ "payload_hash": "<sha256 of the committed canonical bytes>",
115
+ "previous_hash": "GENESIS",
116
+ "signed_at": "2026-06-10T00:00:00.000Z",
117
+ },
118
+ key,
119
+ )
120
+ ```
121
+
122
+ ## What this package implements
123
+
124
+ - The **Verifiable Event Envelope** family contract, `envelope-spec.md` **v1.1 (ratified
125
+ v1.0 2026-06-10, amended 2026-06-11 — additive, same conformance corpus)**, for two
126
+ profiles:
127
+ - **`ario.agent/v1`** — inline-payload envelopes minted by
128
+ [`ar-io-agent`](https://github.com/ar-io/ar-io-agent) (byte-level format:
129
+ `docs/artifact.md`).
130
+ - **`ario.mlflow/v1`** — external-commitment envelopes minted by
131
+ [`ar-io-mlflow`](https://github.com/ar-io/ar-io-mlflow).
132
+ - The **RFC 9162** binary Merkle tree (leaf/node domain separation, audit paths, pinned
133
+ empty-tree root) and the **`ario.agent.proof/v1`** inclusion-proof bundle behind agent
134
+ verification checkpoints.
135
+ - The **accepted-version registry**: `{ario.agent/v1, ario.mlflow/v1}`, fail-closed on
136
+ anything else. Envelopes that predate `spec_version` verify only with an explicit
137
+ `allow_legacy=True`.
138
+ - The signed scope per the ratified contract: the envelope minus `signature`, minus the
139
+ reserved `co_signatures` field (envelope-spec §7.1), and — for `ario.mlflow/v1` and
140
+ legacy envelopes only — minus underscore-prefixed annotation keys. The `ario.agent/v1`
141
+ signed scope is minus `signature`/`co_signatures` only, matching the Go reference
142
+ byte-for-byte.
143
+
144
+ The kernel is exactly the five primitives in the stack architecture's kernel scope — **no
145
+ I/O, no networking, no key lifecycle**. Gateway fetching, attestation polling, and key
146
+ storage belong to the products that import this.
147
+
148
+ ## Conformance
149
+
150
+ This package is conformance-gated against the `ario.agent/v1` corpus at tag
151
+ **`test-vectors-v1.0`**, vendored under [`test-vectors/`](test-vectors/) byte-for-byte (see
152
+ [`test-vectors/VENDORING.md`](test-vectors/VENDORING.md) for provenance). CI asserts, for
153
+ every vector: JCS-canonical bytes, payload hashes, envelope-for-signature bytes,
154
+ deterministic signatures, Merkle roots, and audit paths — exact to the byte. If this
155
+ package disagrees with a vector, the package is wrong — never the vector.
156
+
157
+ mlflow-profile-specific behaviors (external commitment, underscore stripping, legacy
158
+ acceptance) are covered by unit tests; the bidirectional cross-product gate against
159
+ `ar-io-mlflow`'s production verifier lands when mlflow migrates to import this package.
160
+
161
+ ## Trust model
162
+
163
+ `result.ok` proves: *the holder of the private key matching the envelope's `public_key`
164
+ signed exactly these bytes, and the payload binding holds.* It does **not** prove whose key
165
+ that is, or that the envelope is on Arweave — trust in the key comes from out of band (e.g.
166
+ the agent's registration chain), and on-chain presence comes from fetching the TX yourself
167
+ and re-verifying, which is exactly what the quickstart does. `signed_at` is the signer's
168
+ claim, not a trusted timestamp; witnessed time comes from the Arweave block.
169
+
170
+ ## Development
171
+
172
+ ```bash
173
+ python3 -m venv .venv && .venv/bin/pip install -e .[dev]
174
+ .venv/bin/pytest -q # the conformance gate is the contract
175
+ .venv/bin/black src tests
176
+ ```
177
+
178
+ Dependencies are deliberately two: [`PyNaCl`](https://pypi.org/project/PyNaCl/) (Ed25519,
179
+ strict RFC 8032 — matches Go `crypto/ed25519` and the JS sibling verifier) and
180
+ [`jcs`](https://pypi.org/project/jcs/) (reference RFC 8785).
181
+
182
+ ## License
183
+
184
+ MIT — verifier-relevant code is deliberately MIT-licensed so third-party auditors can verify
185
+ independently of ar.io.
@@ -0,0 +1,138 @@
1
+ # ar-io-proof
2
+
3
+ Verification kernel for the [ar.io verification stack](https://github.com/ar-io): RFC 8785
4
+ (JCS) canonicalization, SHA-256 hashing, Ed25519 envelope sign/verify, and RFC 9162 binary
5
+ Merkle inclusion proofs — as a standalone, dependency-light Python package.
6
+
7
+ ```bash
8
+ pip install ar-io-proof
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ Verify a signed envelope fetched from any Arweave gateway:
14
+
15
+ ```python
16
+ import json
17
+ import urllib.request
18
+
19
+ from ario_proof import verify_envelope
20
+
21
+ raw = urllib.request.urlopen("https://arweave.net/raw/<tx_id>").read()
22
+ result = verify_envelope(json.loads(raw))
23
+
24
+ assert result.ok # spec_version + payload binding + Ed25519 signature
25
+ print(result.to_dict())
26
+ ```
27
+
28
+ Bind an artifact you hold to the provenance an envelope commits to (reverse lookup):
29
+
30
+ ```python
31
+ import hashlib
32
+
33
+ artifact_hash = hashlib.sha256(open("model.pkl", "rb").read()).hexdigest()
34
+ result = verify_envelope(envelope, expected_content_hash=artifact_hash)
35
+ print(result.content_hash_ok, result.content_role) # True, "asset"
36
+ ```
37
+
38
+ Verify an external-commitment (`ario.mlflow/v1`) envelope against the committed bytes:
39
+
40
+ ```python
41
+ result = verify_envelope(envelope, payload_bytes=canonical_bytes)
42
+ ```
43
+
44
+ Verify an inclusion-proof bundle (`ariod proof` output — proves a leaf was in a signed
45
+ daily checkpoint):
46
+
47
+ ```python
48
+ from ario_proof import verify_proof_bundle
49
+
50
+ bundle = json.load(open("proof-bundle.json"))
51
+ result = verify_proof_bundle(bundle)
52
+ assert result.ok and result.inclusion_ok
53
+ ```
54
+
55
+ Sign an envelope (producers):
56
+
57
+ ```python
58
+ from ario_proof import sign_envelope, signing_key_from_seed_hex
59
+
60
+ key = signing_key_from_seed_hex("<32-byte seed hex>")
61
+ envelope = sign_envelope(
62
+ {
63
+ "spec_version": "ario.mlflow/v1",
64
+ "event_id": "...",
65
+ "event_type": "training_complete",
66
+ "subject": {"type": "mlflow_run", "run_id": "..."},
67
+ "payload_hash": "<sha256 of the committed canonical bytes>",
68
+ "previous_hash": "GENESIS",
69
+ "signed_at": "2026-06-10T00:00:00.000Z",
70
+ },
71
+ key,
72
+ )
73
+ ```
74
+
75
+ ## What this package implements
76
+
77
+ - The **Verifiable Event Envelope** family contract, `envelope-spec.md` **v1.1 (ratified
78
+ v1.0 2026-06-10, amended 2026-06-11 — additive, same conformance corpus)**, for two
79
+ profiles:
80
+ - **`ario.agent/v1`** — inline-payload envelopes minted by
81
+ [`ar-io-agent`](https://github.com/ar-io/ar-io-agent) (byte-level format:
82
+ `docs/artifact.md`).
83
+ - **`ario.mlflow/v1`** — external-commitment envelopes minted by
84
+ [`ar-io-mlflow`](https://github.com/ar-io/ar-io-mlflow).
85
+ - The **RFC 9162** binary Merkle tree (leaf/node domain separation, audit paths, pinned
86
+ empty-tree root) and the **`ario.agent.proof/v1`** inclusion-proof bundle behind agent
87
+ verification checkpoints.
88
+ - The **accepted-version registry**: `{ario.agent/v1, ario.mlflow/v1}`, fail-closed on
89
+ anything else. Envelopes that predate `spec_version` verify only with an explicit
90
+ `allow_legacy=True`.
91
+ - The signed scope per the ratified contract: the envelope minus `signature`, minus the
92
+ reserved `co_signatures` field (envelope-spec §7.1), and — for `ario.mlflow/v1` and
93
+ legacy envelopes only — minus underscore-prefixed annotation keys. The `ario.agent/v1`
94
+ signed scope is minus `signature`/`co_signatures` only, matching the Go reference
95
+ byte-for-byte.
96
+
97
+ The kernel is exactly the five primitives in the stack architecture's kernel scope — **no
98
+ I/O, no networking, no key lifecycle**. Gateway fetching, attestation polling, and key
99
+ storage belong to the products that import this.
100
+
101
+ ## Conformance
102
+
103
+ This package is conformance-gated against the `ario.agent/v1` corpus at tag
104
+ **`test-vectors-v1.0`**, vendored under [`test-vectors/`](test-vectors/) byte-for-byte (see
105
+ [`test-vectors/VENDORING.md`](test-vectors/VENDORING.md) for provenance). CI asserts, for
106
+ every vector: JCS-canonical bytes, payload hashes, envelope-for-signature bytes,
107
+ deterministic signatures, Merkle roots, and audit paths — exact to the byte. If this
108
+ package disagrees with a vector, the package is wrong — never the vector.
109
+
110
+ mlflow-profile-specific behaviors (external commitment, underscore stripping, legacy
111
+ acceptance) are covered by unit tests; the bidirectional cross-product gate against
112
+ `ar-io-mlflow`'s production verifier lands when mlflow migrates to import this package.
113
+
114
+ ## Trust model
115
+
116
+ `result.ok` proves: *the holder of the private key matching the envelope's `public_key`
117
+ signed exactly these bytes, and the payload binding holds.* It does **not** prove whose key
118
+ that is, or that the envelope is on Arweave — trust in the key comes from out of band (e.g.
119
+ the agent's registration chain), and on-chain presence comes from fetching the TX yourself
120
+ and re-verifying, which is exactly what the quickstart does. `signed_at` is the signer's
121
+ claim, not a trusted timestamp; witnessed time comes from the Arweave block.
122
+
123
+ ## Development
124
+
125
+ ```bash
126
+ python3 -m venv .venv && .venv/bin/pip install -e .[dev]
127
+ .venv/bin/pytest -q # the conformance gate is the contract
128
+ .venv/bin/black src tests
129
+ ```
130
+
131
+ Dependencies are deliberately two: [`PyNaCl`](https://pypi.org/project/PyNaCl/) (Ed25519,
132
+ strict RFC 8032 — matches Go `crypto/ed25519` and the JS sibling verifier) and
133
+ [`jcs`](https://pypi.org/project/jcs/) (reference RFC 8785).
134
+
135
+ ## License
136
+
137
+ MIT — verifier-relevant code is deliberately MIT-licensed so third-party auditors can verify
138
+ independently of ar.io.
@@ -0,0 +1,47 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "ar-io-proof"
7
+ version = "0.1.0"
8
+ description = "Verification kernel for the ar.io verification stack: RFC 8785 canonicalization, SHA-256, Ed25519 envelope sign/verify, RFC 9162 Merkle inclusion proofs."
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "ar.io" }]
13
+ keywords = ["arweave", "ar.io", "verification", "ed25519", "jcs", "rfc8785", "rfc9162", "merkle", "provenance"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Security :: Cryptography",
24
+ ]
25
+ dependencies = [
26
+ "PyNaCl>=1.5.0",
27
+ "jcs>=0.2.1",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = [
32
+ "pytest>=7.0",
33
+ "black>=24.0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Repository = "https://github.com/ar-io/ar-io-proof"
38
+ Issues = "https://github.com/ar-io/ar-io-proof/issues"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/ario_proof"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
45
+
46
+ [tool.black]
47
+ target-version = ["py310", "py311", "py312", "py313"]
@@ -0,0 +1,60 @@
1
+ """ar-io-proof: verification kernel for the ar.io verification stack.
2
+
3
+ Implements the Verifiable Event Envelope family contract (envelope-spec.md
4
+ v1.1 — ratified v1.0 2026-06-10, amended 2026-06-11) for the
5
+ ``ario.agent/v1`` and ``ario.mlflow/v1`` profiles, plus the RFC 9162 binary
6
+ Merkle tree behind agent verification checkpoints. Conformance-gated against
7
+ the ``test-vectors-v1.0`` corpus.
8
+ """
9
+
10
+ from .bundle import BUNDLE_SPEC_VERSION, BundleVerificationResult, verify_proof_bundle
11
+ from .canonicalize import canonical_json, normalize_floats
12
+ from .envelope import (
13
+ ACCEPTED_SPEC_VERSIONS,
14
+ VerificationResult,
15
+ content_hashes,
16
+ envelope_for_signature,
17
+ sign_envelope,
18
+ spec_version_supported,
19
+ verify_envelope,
20
+ )
21
+ from .hash import sha256_hex
22
+ from .merkle import (
23
+ EMPTY_TREE_ROOT_HEX,
24
+ audit_path,
25
+ leaf_hash,
26
+ merkle_root,
27
+ node_hash,
28
+ verify_inclusion,
29
+ )
30
+ from .sign import public_key_hex, sign, signing_key_from_seed_hex
31
+ from .verify import verify_signature
32
+
33
+ __version__ = "0.1.0"
34
+
35
+ __all__ = [
36
+ "__version__",
37
+ "ACCEPTED_SPEC_VERSIONS",
38
+ "BUNDLE_SPEC_VERSION",
39
+ "BundleVerificationResult",
40
+ "EMPTY_TREE_ROOT_HEX",
41
+ "VerificationResult",
42
+ "audit_path",
43
+ "leaf_hash",
44
+ "merkle_root",
45
+ "node_hash",
46
+ "verify_inclusion",
47
+ "verify_proof_bundle",
48
+ "canonical_json",
49
+ "content_hashes",
50
+ "envelope_for_signature",
51
+ "normalize_floats",
52
+ "public_key_hex",
53
+ "sha256_hex",
54
+ "sign",
55
+ "sign_envelope",
56
+ "signing_key_from_seed_hex",
57
+ "spec_version_supported",
58
+ "verify_envelope",
59
+ "verify_signature",
60
+ ]