totum-verify 0.2.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Totum Run LLC
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,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: totum-verify
3
+ Version: 0.2.1
4
+ Summary: Hermetic public-chain and Ed25519 receipt verifier for the Totum audit ledger.
5
+ Author-email: Totum Run LLC <security@totum.run>
6
+ License: MIT
7
+ Project-URL: Homepage, https://totum.run/verify
8
+ Project-URL: Source, https://github.com/Totum-Run-LLC/totum-verify
9
+ Project-URL: Issues, https://github.com/Totum-Run-LLC/totum-verify/issues
10
+ Project-URL: Changelog, https://github.com/Totum-Run-LLC/totum-verify/blob/main/CHANGELOG.md
11
+ Keywords: audit,chain,verifier,ed25519,receipt,cryptography,totum
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Security :: Cryptography
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: cryptography<47,>=41
27
+ Dynamic: license-file
28
+
29
+ # totum-verify
30
+
31
+ [![CI](https://github.com/Totum-Run-LLC/totum-verify/actions/workflows/ci.yml/badge.svg)](https://github.com/Totum-Run-LLC/totum-verify/actions/workflows/ci.yml)
32
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
34
+
35
+ **Independent, zero-internal-dependency cryptographic verifier for Totum audit chains and AI action receipts.**
36
+
37
+ Re-verifies every SHA-256 hash link, metadata-bound transaction ID, and Ed25519 signature locally on your machine using only the Python standard library and [`cryptography`](https://cryptography.io/). Read the entire single-file verifier ([`src/totum_verify/_verifier.py`](./src/totum_verify/_verifier.py)) before running it.
38
+
39
+ ---
40
+
41
+ ## Install
42
+
43
+ From PyPI (once published):
44
+
45
+ ```bash
46
+ pip install totum-verify
47
+ ```
48
+
49
+ Or directly from this public repository today:
50
+
51
+ ```bash
52
+ pip install git+https://github.com/Totum-Run-LLC/totum-verify.git
53
+ ```
54
+
55
+ Or run the verifier with zero installation beyond `cryptography`:
56
+
57
+ ```bash
58
+ pip install cryptography
59
+ python3 src/totum_verify/_verifier.py --remote https://totum.run
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 10-Second Live Verification
65
+
66
+ Verify every signed Ed25519 checkpoint published by [`https://totum.run`](https://totum.run):
67
+
68
+ ```bash
69
+ totum-verify --remote https://totum.run
70
+ ```
71
+
72
+ Example output:
73
+
74
+ ```text
75
+ OK · checkpoints-only mode · 5073 checkpoints (last @ 2026-06-10T12:15:52Z, kid=k-84da2bde)
76
+ ```
77
+
78
+ What this does:
79
+ 1. Fetches `/.well-known/atelier_chain_meta.json` (chain genesis anchor).
80
+ 2. Fetches `/.well-known/atelier_chain_keys.json` (published Ed25519 public keys keyed by `kid`).
81
+ 3. Fetches `/.well-known/atelier_checkpoints.jsonl` (signed checkpoints).
82
+ 4. Re-canonicalizes every checkpoint payload and verifies every Ed25519 signature locally.
83
+
84
+ To also inspect a specific chain feed:
85
+
86
+ ```bash
87
+ totum-verify --remote https://totum.run --chain-id atelier_audit_chain_v3
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Offline Single-Receipt Verification
93
+
94
+ Verify an individual Totum transaction receipt (`payload_hash`, `tx_id` binding, and Ed25519 signature) against a local public-key file or keys fetched over hardened HTTPS:
95
+
96
+ ```bash
97
+ # Against a local key file (totum-chain-pubkey.json or atelier_chain_keys.json)
98
+ totum-verify --receipt receipt.json --keys totum-chain-pubkey.json
99
+
100
+ # Fetching published public keys over pinned HTTPS
101
+ totum-verify --receipt receipt.json --remote https://totum.run
102
+ ```
103
+
104
+ Machine-readable CI output (`--json`):
105
+
106
+ ```bash
107
+ totum-verify --receipt receipt.json --keys totum-chain-pubkey.json --json
108
+ ```
109
+
110
+ ```json
111
+ {
112
+ "ok": true,
113
+ "tx_id": "4e9a1c02b7f183d0",
114
+ "kind": "action_receipt",
115
+ "payload_hash_ok": true,
116
+ "tx_id_ok": true,
117
+ "signature_state": "verified",
118
+ "kid": "k-84da2bde",
119
+ "errors": []
120
+ }
121
+ ```
122
+
123
+ Unsigned receipts **fail closed** by default (`exit 1`). Pass `--allow-unsigned` only if you intentionally want to audit payload/ID hashes on legacy unsigned rows.
124
+
125
+ ---
126
+
127
+ ## Local Chain Verification
128
+
129
+ Verify exported JSONL ledger artifacts completely offline:
130
+
131
+ ```bash
132
+ totum-verify \
133
+ --feed public_feed_recent.jsonl \
134
+ --feed public_feed_live.jsonl \
135
+ --meta chain_meta.json \
136
+ --keys atelier_chain_keys.json \
137
+ --checkpoints checkpoints.jsonl
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Python API
143
+
144
+ ```python
145
+ from totum_verify import verify_chain, verify_receipt
146
+
147
+ # Verify a single receipt dict against a public key bundle
148
+ receipt_result = verify_receipt(receipt_dict, keys_bundle)
149
+ assert receipt_result["ok"] is True
150
+ assert receipt_result["signature_state"] == "verified"
151
+
152
+ # Verify a local chain and signed checkpoints
153
+ chain_result = verify_chain(
154
+ feed_paths=["public_feed_live.jsonl"],
155
+ meta_path="chain_meta.json",
156
+ checkpoints_path="checkpoints.jsonl",
157
+ keys_path="atelier_chain_keys.json",
158
+ )
159
+ assert chain_result["ok"] is True
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Cryptographic Specification
165
+
166
+ | Primitive | Construction |
167
+ | :--- | :--- |
168
+ | **Canonical JSON** | UTF-8 `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)` |
169
+ | **Genesis anchor** | `sha256(canonical(chain_meta))` |
170
+ | **Event hash link** | `sha256(prev_event_hash_ascii + "\n" + canonical(row_without_computed_fields))` |
171
+ | **Receipt payload hash** | `sha256(canonical(receipt["payload"]))` |
172
+ | **Receipt `tx_id` binding** | `sha256(f"{parent_tx_id or ''}|{ts}|{kind}|{actor_id}|{payload_hash}")[:16]` |
173
+ | **Checkpoint signature** | Ed25519 over `canonical(checkpoint_without_sig_b64)` verified with `keys[kid]["pub_b64"]` |
174
+ | **Transaction signature** | `signature = "<kid>:<sig_b64>"` — Ed25519 over `canonical(receipt_without_signature)` |
175
+
176
+ ---
177
+
178
+ ## Exit Codes
179
+
180
+ | Code | Meaning |
181
+ | ---: | :--- |
182
+ | `0` | Integrity and Ed25519 signatures verified — zero breaks. |
183
+ | `1` | Hash link, `payload_hash`, `tx_id`, or Ed25519 signature failed (or network error). |
184
+ | `2` | Invalid CLI arguments (e.g. non-HTTPS `--remote`, credentials in URL, non-public host). |
185
+ | `3` | `cryptography` library is not installed. |
186
+
187
+ ---
188
+
189
+ ## Security & Hardening Guarantees
190
+
191
+ - **Zero Totum-internal dependencies:** Only Python stdlib + `cryptography`. Enforced by AST tests in CI.
192
+ - **SSRF & DNS-rebinding defense:** `--remote` requires `https://`, rejects credentials/queries/fragments, resolves DNS and verifies **every** returned IP is globally routable (blocking loopback, RFC 1918 private, link-local / cloud metadata `169.254.0.0/16`, CGNAT, and IPv4-mapped IPv6), and pins the TCP socket to the vetted IP while enforcing hostname TLS/SNI verification.
193
+ - **No redirects, bounded reads, hard deadline:** HTTP 3xx responses are refused; per-artifact byte caps (`1 MiB` meta/keys, `32 MiB` checkpoints, `64 MiB` chain) and a hard 60-second watchdog prevent slow-drip DoS.
194
+ - **Data-only parsing:** Fetched bytes are parsed strictly via `json.loads` — never executed, imported, or written to disk.
195
+
196
+ ---
197
+
198
+ ## Links & Security
199
+
200
+ - Live proof portal: [`https://totum.run/verify`](https://totum.run/verify)
201
+ - Security policy & vulnerability disclosure: [`SECURITY.md`](./SECURITY.md)
202
+ - Contributing guide: [`CONTRIBUTING.md`](./CONTRIBUTING.md)
203
+ - License: [MIT](./LICENSE)
@@ -0,0 +1,175 @@
1
+ # totum-verify
2
+
3
+ [![CI](https://github.com/Totum-Run-LLC/totum-verify/actions/workflows/ci.yml/badge.svg)](https://github.com/Totum-Run-LLC/totum-verify/actions/workflows/ci.yml)
4
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
6
+
7
+ **Independent, zero-internal-dependency cryptographic verifier for Totum audit chains and AI action receipts.**
8
+
9
+ Re-verifies every SHA-256 hash link, metadata-bound transaction ID, and Ed25519 signature locally on your machine using only the Python standard library and [`cryptography`](https://cryptography.io/). Read the entire single-file verifier ([`src/totum_verify/_verifier.py`](./src/totum_verify/_verifier.py)) before running it.
10
+
11
+ ---
12
+
13
+ ## Install
14
+
15
+ From PyPI (once published):
16
+
17
+ ```bash
18
+ pip install totum-verify
19
+ ```
20
+
21
+ Or directly from this public repository today:
22
+
23
+ ```bash
24
+ pip install git+https://github.com/Totum-Run-LLC/totum-verify.git
25
+ ```
26
+
27
+ Or run the verifier with zero installation beyond `cryptography`:
28
+
29
+ ```bash
30
+ pip install cryptography
31
+ python3 src/totum_verify/_verifier.py --remote https://totum.run
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 10-Second Live Verification
37
+
38
+ Verify every signed Ed25519 checkpoint published by [`https://totum.run`](https://totum.run):
39
+
40
+ ```bash
41
+ totum-verify --remote https://totum.run
42
+ ```
43
+
44
+ Example output:
45
+
46
+ ```text
47
+ OK · checkpoints-only mode · 5073 checkpoints (last @ 2026-06-10T12:15:52Z, kid=k-84da2bde)
48
+ ```
49
+
50
+ What this does:
51
+ 1. Fetches `/.well-known/atelier_chain_meta.json` (chain genesis anchor).
52
+ 2. Fetches `/.well-known/atelier_chain_keys.json` (published Ed25519 public keys keyed by `kid`).
53
+ 3. Fetches `/.well-known/atelier_checkpoints.jsonl` (signed checkpoints).
54
+ 4. Re-canonicalizes every checkpoint payload and verifies every Ed25519 signature locally.
55
+
56
+ To also inspect a specific chain feed:
57
+
58
+ ```bash
59
+ totum-verify --remote https://totum.run --chain-id atelier_audit_chain_v3
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Offline Single-Receipt Verification
65
+
66
+ Verify an individual Totum transaction receipt (`payload_hash`, `tx_id` binding, and Ed25519 signature) against a local public-key file or keys fetched over hardened HTTPS:
67
+
68
+ ```bash
69
+ # Against a local key file (totum-chain-pubkey.json or atelier_chain_keys.json)
70
+ totum-verify --receipt receipt.json --keys totum-chain-pubkey.json
71
+
72
+ # Fetching published public keys over pinned HTTPS
73
+ totum-verify --receipt receipt.json --remote https://totum.run
74
+ ```
75
+
76
+ Machine-readable CI output (`--json`):
77
+
78
+ ```bash
79
+ totum-verify --receipt receipt.json --keys totum-chain-pubkey.json --json
80
+ ```
81
+
82
+ ```json
83
+ {
84
+ "ok": true,
85
+ "tx_id": "4e9a1c02b7f183d0",
86
+ "kind": "action_receipt",
87
+ "payload_hash_ok": true,
88
+ "tx_id_ok": true,
89
+ "signature_state": "verified",
90
+ "kid": "k-84da2bde",
91
+ "errors": []
92
+ }
93
+ ```
94
+
95
+ Unsigned receipts **fail closed** by default (`exit 1`). Pass `--allow-unsigned` only if you intentionally want to audit payload/ID hashes on legacy unsigned rows.
96
+
97
+ ---
98
+
99
+ ## Local Chain Verification
100
+
101
+ Verify exported JSONL ledger artifacts completely offline:
102
+
103
+ ```bash
104
+ totum-verify \
105
+ --feed public_feed_recent.jsonl \
106
+ --feed public_feed_live.jsonl \
107
+ --meta chain_meta.json \
108
+ --keys atelier_chain_keys.json \
109
+ --checkpoints checkpoints.jsonl
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Python API
115
+
116
+ ```python
117
+ from totum_verify import verify_chain, verify_receipt
118
+
119
+ # Verify a single receipt dict against a public key bundle
120
+ receipt_result = verify_receipt(receipt_dict, keys_bundle)
121
+ assert receipt_result["ok"] is True
122
+ assert receipt_result["signature_state"] == "verified"
123
+
124
+ # Verify a local chain and signed checkpoints
125
+ chain_result = verify_chain(
126
+ feed_paths=["public_feed_live.jsonl"],
127
+ meta_path="chain_meta.json",
128
+ checkpoints_path="checkpoints.jsonl",
129
+ keys_path="atelier_chain_keys.json",
130
+ )
131
+ assert chain_result["ok"] is True
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Cryptographic Specification
137
+
138
+ | Primitive | Construction |
139
+ | :--- | :--- |
140
+ | **Canonical JSON** | UTF-8 `json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)` |
141
+ | **Genesis anchor** | `sha256(canonical(chain_meta))` |
142
+ | **Event hash link** | `sha256(prev_event_hash_ascii + "\n" + canonical(row_without_computed_fields))` |
143
+ | **Receipt payload hash** | `sha256(canonical(receipt["payload"]))` |
144
+ | **Receipt `tx_id` binding** | `sha256(f"{parent_tx_id or ''}|{ts}|{kind}|{actor_id}|{payload_hash}")[:16]` |
145
+ | **Checkpoint signature** | Ed25519 over `canonical(checkpoint_without_sig_b64)` verified with `keys[kid]["pub_b64"]` |
146
+ | **Transaction signature** | `signature = "<kid>:<sig_b64>"` — Ed25519 over `canonical(receipt_without_signature)` |
147
+
148
+ ---
149
+
150
+ ## Exit Codes
151
+
152
+ | Code | Meaning |
153
+ | ---: | :--- |
154
+ | `0` | Integrity and Ed25519 signatures verified — zero breaks. |
155
+ | `1` | Hash link, `payload_hash`, `tx_id`, or Ed25519 signature failed (or network error). |
156
+ | `2` | Invalid CLI arguments (e.g. non-HTTPS `--remote`, credentials in URL, non-public host). |
157
+ | `3` | `cryptography` library is not installed. |
158
+
159
+ ---
160
+
161
+ ## Security & Hardening Guarantees
162
+
163
+ - **Zero Totum-internal dependencies:** Only Python stdlib + `cryptography`. Enforced by AST tests in CI.
164
+ - **SSRF & DNS-rebinding defense:** `--remote` requires `https://`, rejects credentials/queries/fragments, resolves DNS and verifies **every** returned IP is globally routable (blocking loopback, RFC 1918 private, link-local / cloud metadata `169.254.0.0/16`, CGNAT, and IPv4-mapped IPv6), and pins the TCP socket to the vetted IP while enforcing hostname TLS/SNI verification.
165
+ - **No redirects, bounded reads, hard deadline:** HTTP 3xx responses are refused; per-artifact byte caps (`1 MiB` meta/keys, `32 MiB` checkpoints, `64 MiB` chain) and a hard 60-second watchdog prevent slow-drip DoS.
166
+ - **Data-only parsing:** Fetched bytes are parsed strictly via `json.loads` — never executed, imported, or written to disk.
167
+
168
+ ---
169
+
170
+ ## Links & Security
171
+
172
+ - Live proof portal: [`https://totum.run/verify`](https://totum.run/verify)
173
+ - Security policy & vulnerability disclosure: [`SECURITY.md`](./SECURITY.md)
174
+ - Contributing guide: [`CONTRIBUTING.md`](./CONTRIBUTING.md)
175
+ - License: [MIT](./LICENSE)
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "totum-verify"
7
+ version = "0.2.1"
8
+ description = "Hermetic public-chain and Ed25519 receipt verifier for the Totum audit ledger."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Totum Run LLC", email = "security@totum.run" },
14
+ ]
15
+ keywords = ["audit", "chain", "verifier", "ed25519", "receipt", "cryptography", "totum"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Security :: Cryptography",
28
+ ]
29
+ dependencies = [
30
+ "cryptography>=41,<47",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://totum.run/verify"
35
+ Source = "https://github.com/Totum-Run-LLC/totum-verify"
36
+ Issues = "https://github.com/Totum-Run-LLC/totum-verify/issues"
37
+ Changelog = "https://github.com/Totum-Run-LLC/totum-verify/blob/main/CHANGELOG.md"
38
+
39
+ [project.scripts]
40
+ totum-verify = "totum_verify.__main__:cli"
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+ include = ["totum_verify*"]
45
+
46
+ [tool.setuptools.package-data]
47
+ totum_verify = ["py.typed"]
48
+
49
+ [tool.pytest.ini_options]
50
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,20 @@
1
+ """totum_verify — hermetic verifier for the Totum audit chain and receipts.
2
+
3
+ Public API:
4
+ >>> from totum_verify import verify_chain, verify_receipt
5
+ >>> result = verify_chain(...)
6
+ >>> print(result["ok"], result["length"])
7
+
8
+ The verifier reimplements the chain hash + Ed25519 signature primitives over
9
+ stdlib + `cryptography`. Zero Totum-internal imports. Clone-and-run for
10
+ external auditors.
11
+
12
+ CLI:
13
+ $ totum-verify --remote https://totum.run
14
+ $ totum-verify --receipt receipt.json --remote https://totum.run
15
+ """
16
+
17
+ from totum_verify._verifier import RemoteFetchError, verify_chain, verify_receipt
18
+
19
+ __version__ = "0.2.1"
20
+ __all__ = ["RemoteFetchError", "verify_chain", "verify_receipt", "__version__"]
@@ -0,0 +1,14 @@
1
+ """CLI entry point. Re-exports the verifier's `main()` as `cli()`.
2
+
3
+ Invocable via:
4
+ $ totum-verify --remote https://totum.run
5
+ $ totum-verify --remote https://totum.run --chain-id atelier_audit_chain_v3
6
+ $ totum-verify --receipt receipt.json --remote https://totum.run
7
+ $ python -m totum_verify --remote https://totum.run
8
+ """
9
+
10
+ from totum_verify._verifier import main as cli
11
+
12
+
13
+ if __name__ == "__main__":
14
+ cli()