vauban-verify 1.0.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.
- vauban_verify-1.0.0/.gitignore +12 -0
- vauban_verify-1.0.0/LICENSE +21 -0
- vauban_verify-1.0.0/PKG-INFO +128 -0
- vauban_verify-1.0.0/README.md +103 -0
- vauban_verify-1.0.0/pyproject.toml +41 -0
- vauban_verify-1.0.0/tests/cross-lang-vectors.json +502 -0
- vauban_verify-1.0.0/tests/generate-vectors.ts +242 -0
- vauban_verify-1.0.0/tests/test_cli.py +134 -0
- vauban_verify-1.0.0/tests/test_poseidon.py +177 -0
- vauban_verify-1.0.0/vauban_verify/__init__.py +51 -0
- vauban_verify-1.0.0/vauban_verify/__main__.py +8 -0
- vauban_verify-1.0.0/vauban_verify/cert.py +128 -0
- vauban_verify-1.0.0/vauban_verify/cli.py +85 -0
- vauban_verify-1.0.0/vauban_verify/jcs.py +70 -0
- vauban_verify-1.0.0/vauban_verify/poseidon.py +203 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vauban Research
|
|
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,128 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vauban-verify
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Offline cryptographic verifier for Vauban Command Center proof certificates.
|
|
5
|
+
Project-URL: Homepage, https://vauban.tech
|
|
6
|
+
Project-URL: Repository, https://github.com/seritalien/command-center
|
|
7
|
+
Author-email: Vauban <ops@vauban.tech>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: merkle,poseidon,proof,starknet,verifier,zk
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Security :: Cryptography
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: starknet-py>=0.24.0
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# vauban-verify
|
|
27
|
+
|
|
28
|
+
Offline cryptographic verifier for Vauban Command Center proof certificates.
|
|
29
|
+
|
|
30
|
+
Recomputes the Poseidon Merkle root from a certificate's `decision_chain` and
|
|
31
|
+
asserts it matches the certificate's anchored `merkle_root`. **No network
|
|
32
|
+
calls. No trust in our infrastructure or keys.** Trust derives entirely from
|
|
33
|
+
your independent on-chain read of the anchored root.
|
|
34
|
+
|
|
35
|
+
Pure Python; the only runtime dependency is
|
|
36
|
+
[`starknet-py`](https://github.com/software-mansion/starknet.py) (vendored
|
|
37
|
+
`poseidon-py` for native felt252 arithmetic).
|
|
38
|
+
|
|
39
|
+
The reference implementation lives in
|
|
40
|
+
`command-center/src/proof/poseidon-hasher.ts` (sprint-521, commit `139d76e`).
|
|
41
|
+
Cross-language parity is enforced by 30 deterministic test vectors checked in
|
|
42
|
+
CI — any drift between TypeScript and Python fails the build.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install vauban-verify
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or from source:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/seritalien/command-center
|
|
54
|
+
cd command-center/tools/vauban-verify
|
|
55
|
+
pip install -e ".[test]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Requires Python ≥ 3.10.
|
|
59
|
+
|
|
60
|
+
## CLI usage
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
vauban-verify path/to/cert.json
|
|
64
|
+
# → vauban-verify: OK — run_id=<…> leaves=<N> root=0x…
|
|
65
|
+
echo $? # 0 = valid, 1 = tampered/invalid, 2 = usage error
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Library usage
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from vauban_verify import (
|
|
72
|
+
compute_step_leaf_hash,
|
|
73
|
+
compute_poseidon_merkle_root,
|
|
74
|
+
verify_poseidon_merkle_proof,
|
|
75
|
+
load_certificate,
|
|
76
|
+
verify_offline,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Recompute a leaf from a run_step payload
|
|
80
|
+
leaf = compute_step_leaf_hash({"step_id": "s1", "type": "decision", "agent": "BUILDER"})
|
|
81
|
+
|
|
82
|
+
# Recompute a Merkle root from a list of leaves
|
|
83
|
+
root = compute_poseidon_merkle_root([leaf, ...])
|
|
84
|
+
|
|
85
|
+
# Verify a sibling-path inclusion proof
|
|
86
|
+
ok = verify_poseidon_merkle_proof(leaf, proof, root)
|
|
87
|
+
|
|
88
|
+
# Verify a full certificate offline
|
|
89
|
+
cert = load_certificate("cert.json")
|
|
90
|
+
verify_offline(cert) # raises VerifierError on any inconsistency
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Security model
|
|
94
|
+
|
|
95
|
+
| Threat | Defended by |
|
|
96
|
+
|-----------------------------------------|-------------------------------------------------------------|
|
|
97
|
+
| Compromised Vauban infrastructure | This verifier runs offline; never contacts our servers |
|
|
98
|
+
| Compromised Vauban signing keys | The verifier asserts only Merkle consistency; trust the chain anchor, not us |
|
|
99
|
+
| Hash-function preimage attacks | Poseidon over felt252 — STARK-friendly, post-quantum sound |
|
|
100
|
+
| Drift between TS reference and verifier | 30 cross-language vectors gated in CI (regen + diff) |
|
|
101
|
+
|
|
102
|
+
The only thing that *should* be trusted is the on-chain `merkle_root`. Read it
|
|
103
|
+
yourself from Starknet (e.g. via `starknet-py`'s `read_contract`) and compare
|
|
104
|
+
to `cert.merkle_root` — this verifier proves the rest of the certificate is
|
|
105
|
+
internally consistent with that root.
|
|
106
|
+
|
|
107
|
+
## Algorithm reference
|
|
108
|
+
|
|
109
|
+
* **JCS canonicalisation** (RFC 8785 subset): keys sorted recursively, `-0 → 0`,
|
|
110
|
+
arrays preserve order, `JSON.stringify`-equivalent emission.
|
|
111
|
+
* **Step leaf**: `Poseidon([0x1, sha256_to_31_felt(JCS(payload)), step_marker])`.
|
|
112
|
+
* **Merkle**: leaves sorted lexicographically, padded with
|
|
113
|
+
`Poseidon([0, 0])` to next power of 2, commutative pair-merge with
|
|
114
|
+
`Poseidon([min, max])`.
|
|
115
|
+
|
|
116
|
+
Hex output matches `starknet.js`: lowercase, `0x`-prefixed, no leading-zero
|
|
117
|
+
padding (e.g. `POSEIDON_NULL_LEAF =
|
|
118
|
+
0x1fb7169b936dd880cb7ebc50e932a495a60e0084cdab94a681040cb4006e1a0`).
|
|
119
|
+
|
|
120
|
+
## Publishing
|
|
121
|
+
|
|
122
|
+
Releases are published to PyPI via Trusted Publishers (sigstore-signed) using
|
|
123
|
+
the `.github/workflows/vauban-verify-publish.yml` workflow. Tag a release with
|
|
124
|
+
`vauban-verify-vX.Y.Z` to trigger publication.
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# vauban-verify
|
|
2
|
+
|
|
3
|
+
Offline cryptographic verifier for Vauban Command Center proof certificates.
|
|
4
|
+
|
|
5
|
+
Recomputes the Poseidon Merkle root from a certificate's `decision_chain` and
|
|
6
|
+
asserts it matches the certificate's anchored `merkle_root`. **No network
|
|
7
|
+
calls. No trust in our infrastructure or keys.** Trust derives entirely from
|
|
8
|
+
your independent on-chain read of the anchored root.
|
|
9
|
+
|
|
10
|
+
Pure Python; the only runtime dependency is
|
|
11
|
+
[`starknet-py`](https://github.com/software-mansion/starknet.py) (vendored
|
|
12
|
+
`poseidon-py` for native felt252 arithmetic).
|
|
13
|
+
|
|
14
|
+
The reference implementation lives in
|
|
15
|
+
`command-center/src/proof/poseidon-hasher.ts` (sprint-521, commit `139d76e`).
|
|
16
|
+
Cross-language parity is enforced by 30 deterministic test vectors checked in
|
|
17
|
+
CI — any drift between TypeScript and Python fails the build.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install vauban-verify
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or from source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/seritalien/command-center
|
|
29
|
+
cd command-center/tools/vauban-verify
|
|
30
|
+
pip install -e ".[test]"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requires Python ≥ 3.10.
|
|
34
|
+
|
|
35
|
+
## CLI usage
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
vauban-verify path/to/cert.json
|
|
39
|
+
# → vauban-verify: OK — run_id=<…> leaves=<N> root=0x…
|
|
40
|
+
echo $? # 0 = valid, 1 = tampered/invalid, 2 = usage error
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Library usage
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from vauban_verify import (
|
|
47
|
+
compute_step_leaf_hash,
|
|
48
|
+
compute_poseidon_merkle_root,
|
|
49
|
+
verify_poseidon_merkle_proof,
|
|
50
|
+
load_certificate,
|
|
51
|
+
verify_offline,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Recompute a leaf from a run_step payload
|
|
55
|
+
leaf = compute_step_leaf_hash({"step_id": "s1", "type": "decision", "agent": "BUILDER"})
|
|
56
|
+
|
|
57
|
+
# Recompute a Merkle root from a list of leaves
|
|
58
|
+
root = compute_poseidon_merkle_root([leaf, ...])
|
|
59
|
+
|
|
60
|
+
# Verify a sibling-path inclusion proof
|
|
61
|
+
ok = verify_poseidon_merkle_proof(leaf, proof, root)
|
|
62
|
+
|
|
63
|
+
# Verify a full certificate offline
|
|
64
|
+
cert = load_certificate("cert.json")
|
|
65
|
+
verify_offline(cert) # raises VerifierError on any inconsistency
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Security model
|
|
69
|
+
|
|
70
|
+
| Threat | Defended by |
|
|
71
|
+
|-----------------------------------------|-------------------------------------------------------------|
|
|
72
|
+
| Compromised Vauban infrastructure | This verifier runs offline; never contacts our servers |
|
|
73
|
+
| Compromised Vauban signing keys | The verifier asserts only Merkle consistency; trust the chain anchor, not us |
|
|
74
|
+
| Hash-function preimage attacks | Poseidon over felt252 — STARK-friendly, post-quantum sound |
|
|
75
|
+
| Drift between TS reference and verifier | 30 cross-language vectors gated in CI (regen + diff) |
|
|
76
|
+
|
|
77
|
+
The only thing that *should* be trusted is the on-chain `merkle_root`. Read it
|
|
78
|
+
yourself from Starknet (e.g. via `starknet-py`'s `read_contract`) and compare
|
|
79
|
+
to `cert.merkle_root` — this verifier proves the rest of the certificate is
|
|
80
|
+
internally consistent with that root.
|
|
81
|
+
|
|
82
|
+
## Algorithm reference
|
|
83
|
+
|
|
84
|
+
* **JCS canonicalisation** (RFC 8785 subset): keys sorted recursively, `-0 → 0`,
|
|
85
|
+
arrays preserve order, `JSON.stringify`-equivalent emission.
|
|
86
|
+
* **Step leaf**: `Poseidon([0x1, sha256_to_31_felt(JCS(payload)), step_marker])`.
|
|
87
|
+
* **Merkle**: leaves sorted lexicographically, padded with
|
|
88
|
+
`Poseidon([0, 0])` to next power of 2, commutative pair-merge with
|
|
89
|
+
`Poseidon([min, max])`.
|
|
90
|
+
|
|
91
|
+
Hex output matches `starknet.js`: lowercase, `0x`-prefixed, no leading-zero
|
|
92
|
+
padding (e.g. `POSEIDON_NULL_LEAF =
|
|
93
|
+
0x1fb7169b936dd880cb7ebc50e932a495a60e0084cdab94a681040cb4006e1a0`).
|
|
94
|
+
|
|
95
|
+
## Publishing
|
|
96
|
+
|
|
97
|
+
Releases are published to PyPI via Trusted Publishers (sigstore-signed) using
|
|
98
|
+
the `.github/workflows/vauban-verify-publish.yml` workflow. Tag a release with
|
|
99
|
+
`vauban-verify-vX.Y.Z` to trigger publication.
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "vauban-verify"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Offline cryptographic verifier for Vauban Command Center proof certificates."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
authors = [{ name = "Vauban", email = "ops@vauban.tech" }]
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
dependencies = ["starknet-py>=0.24.0"]
|
|
10
|
+
keywords = ["starknet", "poseidon", "merkle", "zk", "proof", "verifier"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Topic :: Security :: Cryptography",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://vauban.tech"
|
|
25
|
+
Repository = "https://github.com/seritalien/command-center"
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
vauban-verify = "vauban_verify.__main__:main"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
test = ["pytest>=7.0"]
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["hatchling"]
|
|
35
|
+
build-backend = "hatchling.build"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["vauban_verify"]
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.sdist]
|
|
41
|
+
include = ["vauban_verify", "tests", "README.md", "pyproject.toml"]
|