aetherproof 0.4.0__tar.gz → 0.5.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.
- aetherproof-0.5.1/PKG-INFO +255 -0
- aetherproof-0.5.1/README.md +225 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/__init__.py +2 -2
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/auto.py +4 -4
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/cli.py +5 -5
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/hash.py +2 -2
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/keystore.py +8 -8
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/log.py +10 -10
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/receipt.py +17 -17
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/session.py +7 -7
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/verifier.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/ui/__init__.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/ui/display.py +13 -13
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/ui/easy_mode.py +28 -28
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/ui/expert_mode.py +19 -19
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/ui/menus.py +2 -2
- aetherproof-0.5.1/aetherproof.egg-info/PKG-INFO +255 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof.egg-info/SOURCES.txt +3 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/pyproject.toml +3 -3
- aetherproof-0.5.1/tests/security/README.md +32 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_cli_contract.py +2 -2
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_hardening_v13.py +5 -5
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_parsing_and_types.py +3 -3
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_preimage_injectivity.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_v12_extensions.py +4 -4
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/stress/full_audit.py +21 -21
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/stress/industrial_stress.py +19 -19
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/stress/isolation_audit.py +17 -17
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_auto.py +27 -9
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_cli_entry.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_cli_paths.py +8 -8
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_core_coverage.py +10 -10
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_display.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_easy_mode.py +4 -4
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_expert_mode.py +4 -4
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_independent_verification.py +4 -4
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_log.py +3 -3
- aetherproof-0.5.1/tests/test_native_equivalence.py +211 -0
- aetherproof-0.5.1/tests/test_native_security.py +261 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_readme_verifier.py +60 -15
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_receipt.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_session.py +3 -3
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_session_binding.py +2 -2
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_verifier.py +1 -1
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_verify_wizard.py +1 -1
- aetherproof-0.5.1/tests/test_version_consistency.py +64 -0
- aetherproof-0.4.0/PKG-INFO +0 -372
- aetherproof-0.4.0/README.md +0 -342
- aetherproof-0.4.0/aetherproof.egg-info/PKG-INFO +0 -372
- aetherproof-0.4.0/tests/security/README.md +0 -32
- {aetherproof-0.4.0 → aetherproof-0.5.1}/LICENSE +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/MANIFEST.in +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/__main__.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/__init__.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof/core/signer.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof.egg-info/dependency_links.txt +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof.egg-info/entry_points.txt +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof.egg-info/requires.txt +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/aetherproof.egg-info/top_level.txt +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/setup.cfg +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/conftest.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_cloud_api_attested.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/security/test_cloud_models_matrix.py +0 -0
- {aetherproof-0.4.0 → aetherproof-0.5.1}/tests/test_key_rotation.py +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aetherproof
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: AetherProof - the open-source receipt engine. Prototype of Signet.
|
|
5
|
+
Author-email: Pulkit Kr Srivastava <pulkitsrivastavae@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: cryptography,ai,audit,compliance,ed25519,receipt,tamper-proof
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: cryptography>=41.0.0
|
|
22
|
+
Requires-Dist: rich>=13.0.0
|
|
23
|
+
Requires-Dist: questionary>=2.0.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="docs/signet-logo.png" alt="Signet" width="240">
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
# AetherProof
|
|
36
|
+
|
|
37
|
+
**Cryptographic receipts for AI output.** Prove a model's output has not been
|
|
38
|
+
modified - no server, no account, verifiable offline forever.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install aetherproof
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> **Not a developer?** Start with the [plain-language guide](docs/GETTING-STARTED.md)
|
|
45
|
+
> - first receipt in three steps, no code.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## The problem
|
|
50
|
+
|
|
51
|
+
Somebody acts on an AI's output. Weeks later it is questioned:
|
|
52
|
+
|
|
53
|
+
> *"Did it really say that, or did you change it afterwards?"*
|
|
54
|
+
|
|
55
|
+
Today that argument is unwinnable in both directions. You cannot prove you did not
|
|
56
|
+
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
57
|
+
control prove nothing, because you control them.
|
|
58
|
+
|
|
59
|
+
**AetherProof turns that into arithmetic that either checks or does not.**
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Use it
|
|
64
|
+
|
|
65
|
+
### Sign one output
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from aetherproof.auto import sign
|
|
69
|
+
|
|
70
|
+
resp = client.chat.completions.create(model="gpt-4o", messages=[...])
|
|
71
|
+
out = resp.choices[0].message.content
|
|
72
|
+
|
|
73
|
+
sign(prompt=user_prompt, output=out, model_id=resp.model)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That is the whole integration. It never prompts, never blocks. On failure it
|
|
77
|
+
returns `None` and your program continues - set `AETHERPROOF_STRICT=1` if a missing
|
|
78
|
+
receipt should be an error instead.
|
|
79
|
+
|
|
80
|
+
### Wrap a function you already have
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from aetherproof.auto import receipted
|
|
84
|
+
|
|
85
|
+
@receipted(model_id="gpt-4o")
|
|
86
|
+
def ask(prompt: str) -> str:
|
|
87
|
+
return client.chat.completions.create(...).choices[0].message.content
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
No call sites change.
|
|
91
|
+
|
|
92
|
+
### A whole conversation, one signature
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from aetherproof.auto import AutoSession
|
|
96
|
+
|
|
97
|
+
with AutoSession(model_id="gpt-4o") as chat: # seals on exit
|
|
98
|
+
for prompt in prompts:
|
|
99
|
+
chat.turn(prompt=prompt, output=ask(prompt))
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
At 1,000 turns that is **one 412-byte seal**. Proving any single turn costs 10
|
|
103
|
+
hashes and about 1 KB, and reveals nothing about the other 999.
|
|
104
|
+
|
|
105
|
+
### From the command line
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
aetherproof sign model.onnx output.txt
|
|
109
|
+
aetherproof verify receipt.json --output output.txt
|
|
110
|
+
aetherproof # interactive menu
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**More recipes:** [docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
114
|
+
question, every snippet tested.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Verify it
|
|
119
|
+
|
|
120
|
+
Verification needs **21 lines and one dependency**. No network, no account, no
|
|
121
|
+
special hardware, and it keeps working if this project is abandoned.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install cryptography # that is the entire requirement
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**The shape of it**, so you can see there is no trick - this is illustrative, not
|
|
128
|
+
complete:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
|
132
|
+
import json
|
|
133
|
+
|
|
134
|
+
r = json.load(open("receipt.json"))
|
|
135
|
+
pub = Ed25519PublicKey.from_public_bytes(bytes.fromhex(r["public_key"]))
|
|
136
|
+
|
|
137
|
+
# every field length-prefixed as "<len>:<field>", concatenated, then signed
|
|
138
|
+
preimage = build_preimage(r) # see the full version below
|
|
139
|
+
pub.verify(bytes.fromhex(r["signature"]), preimage) # raises if invalid
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
> **Do not ship the snippet above.** It omits `log_sequence`, `hw_evidence`, the
|
|
143
|
+
> v1.2 extension commitment, and the v1.3 `receipt_id` and `signing_key_id`, so it
|
|
144
|
+
> rejects every receipt the current version produces. The complete verifier - 21
|
|
145
|
+
> lines, tested on every commit against real receipts - is in
|
|
146
|
+
> **[docs/VERIFICATION.md](docs/VERIFICATION.md)**.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## What it proves
|
|
151
|
+
|
|
152
|
+
| Claim | Mechanism |
|
|
153
|
+
|---|---|
|
|
154
|
+
| This exact output was not modified after signing | `output_hash` inside the signed preimage |
|
|
155
|
+
| The receipt itself was not altered | Ed25519 over a length-prefixed canonical preimage |
|
|
156
|
+
| It was signed by the holder of a specific key | Ed25519 verify, no other input |
|
|
157
|
+
| A claimed time and log position were fixed at signing | both inside the preimage |
|
|
158
|
+
| The local log was not edited, reordered, or truncated in the middle | key-free hash chain |
|
|
159
|
+
| A specific turn belongs to a sealed session | Merkle inclusion proof, revealing no other turn |
|
|
160
|
+
| Anyone can check all of it offline, forever | receipt + public key, nothing else |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## What it does **not** prove
|
|
165
|
+
|
|
166
|
+
Read this before citing anything above.
|
|
167
|
+
|
|
168
|
+
**Integrity, not completeness.** *"Show me the record of this decision"* is answered.
|
|
169
|
+
*"Show me that you logged them all"* is not. Someone who logs 9,000 of 10,000
|
|
170
|
+
outputs passes every check here. That cannot be fixed locally - it needs an
|
|
171
|
+
independent witness, which does not exist yet.
|
|
172
|
+
|
|
173
|
+
| Not proven | Why |
|
|
174
|
+
|---|---|
|
|
175
|
+
| That the named model produced the output | it signs a `(model, output)` pair you supply |
|
|
176
|
+
| That the timestamp is truthful | it is your own clock - bound, not externally anchored |
|
|
177
|
+
| That the signing key is held securely | a software key on disk unless you set a passphrase |
|
|
178
|
+
| That it survives a quantum adversary | Python is Ed25519 only; ML-DSA-65 is in the Rust core |
|
|
179
|
+
|
|
180
|
+
**Where it does not fit at all:** detecting deepfakes or unsigned AI content. A
|
|
181
|
+
scammer never signs, so there is nothing to verify.
|
|
182
|
+
|
|
183
|
+
Full list: [docs/CLAIMS.md](docs/CLAIMS.md).
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Two implementations
|
|
188
|
+
|
|
189
|
+
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| Receipt | **128 B fixed binary** | 646 B JSON |
|
|
192
|
+
| Post-quantum | **ML-DSA-65 (FIPS 204)** | none |
|
|
193
|
+
| Secret zeroization, constant-time compare | **yes** | no |
|
|
194
|
+
| `unsafe` in production | **zero, compiler-enforced** | n/a |
|
|
195
|
+
| Tests | 59 | 642 (93% coverage) |
|
|
196
|
+
| Distribution | source + CI wheels | PyPI |
|
|
197
|
+
|
|
198
|
+
Measured, 50,000 leaves, medians of seven isolated runs: Rust builds a Merkle tree
|
|
199
|
+
in **28.16 ms** against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
200
|
+
**3.93 µs** against 17.17 µs (4.4x).
|
|
201
|
+
|
|
202
|
+
The Rust core is optional. `aetherproof` does not import it and behaves identically
|
|
203
|
+
without it - enforced in CI. See [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
204
|
+
|
|
205
|
+
### Secrets that get wiped
|
|
206
|
+
|
|
207
|
+
A signing key held as a Python `bytes` object cannot be wiped - it is immutable, and
|
|
208
|
+
garbage collection does not overwrite the allocation. `SecureSigner` keeps the key
|
|
209
|
+
inside Rust and overwrites it on release, including when a block exits by exception.
|
|
210
|
+
|
|
211
|
+
```python
|
|
212
|
+
import _native
|
|
213
|
+
|
|
214
|
+
with _native.SecureSigner() as signer: # key wiped on exit
|
|
215
|
+
pub = signer.public_key() # nothing returns the secret
|
|
216
|
+
receipt = signer.sign_receipt(pid=1, binary=model_bytes,
|
|
217
|
+
memory_hash=0, syscall_count=1)
|
|
218
|
+
|
|
219
|
+
assert _native.SecureVerifier(pub).verify_receipt(receipt)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Setup and post-quantum usage: [docs/INTEGRATION.md](docs/INTEGRATION.md#path-c--secrets-that-get-wiped).
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Documentation
|
|
227
|
+
|
|
228
|
+
| | |
|
|
229
|
+
|---|---|
|
|
230
|
+
| [INTEGRATION.md](docs/INTEGRATION.md) | **start here** - pick a path by one question |
|
|
231
|
+
| [GETTING-STARTED.md](docs/GETTING-STARTED.md) | first receipt, no code |
|
|
232
|
+
| [CLAIMS.md](docs/CLAIMS.md) | what this proves and what it does not |
|
|
233
|
+
| [VERIFICATION.md](docs/VERIFICATION.md) | the offline verifier, in full |
|
|
234
|
+
| [CLOUD-MODELS.md](docs/CLOUD-MODELS.md) | local weights vs an API you do not control |
|
|
235
|
+
| [AGENT-CHAIN.md](docs/AGENT-CHAIN.md) | binding agent context (receipt v1.2) |
|
|
236
|
+
| [SECURITY.md](SECURITY.md) | reporting a vulnerability, threat model, known issues |
|
|
237
|
+
| [ROADMAP.md](docs/ROADMAP.md) | 0.5.x - Rust core, bindings, post-quantum |
|
|
238
|
+
| [ANALYSIS.md](docs/ANALYSIS.md) | measured assessment, including what is unverified |
|
|
239
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | extension and spec workflow |
|
|
240
|
+
| [RELEASE-NOTES-0.5.1.md](docs/RELEASE-NOTES-0.5.1.md) | what changed in 0.5.1 |
|
|
241
|
+
| [RELEASE-NOTES-0.4.0.md](docs/RELEASE-NOTES-0.4.0.md) | what changed in 0.4.0 |
|
|
242
|
+
| [agent-chain-context-response.md](docs/agent-chain-context-response.md) | the v1.2 design discussion, from issue #1 |
|
|
243
|
+
| [DEMO.md](docs/DEMO.md) | recording a walkthrough |
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
**Apache-2.0.** Use it, deploy it, fork it, embed it in a commercial product - no
|
|
250
|
+
copyleft obligation. The receipt format and the offline verifier are meant to be
|
|
251
|
+
copied freely; a proof layer nobody can adopt is not a proof layer.
|
|
252
|
+
|
|
253
|
+
*Versions up to 0.2.2 were AGPL-3.0-or-later. From 0.3.0 onward: Apache-2.0.*
|
|
254
|
+
|
|
255
|
+
Security issues: **[SECURITY.md](SECURITY.md)** - please do not open a public issue.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/signet-logo.png" alt="Signet" width="240">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# AetherProof
|
|
6
|
+
|
|
7
|
+
**Cryptographic receipts for AI output.** Prove a model's output has not been
|
|
8
|
+
modified - no server, no account, verifiable offline forever.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install aetherproof
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
> **Not a developer?** Start with the [plain-language guide](docs/GETTING-STARTED.md)
|
|
15
|
+
> - first receipt in three steps, no code.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## The problem
|
|
20
|
+
|
|
21
|
+
Somebody acts on an AI's output. Weeks later it is questioned:
|
|
22
|
+
|
|
23
|
+
> *"Did it really say that, or did you change it afterwards?"*
|
|
24
|
+
|
|
25
|
+
Today that argument is unwinnable in both directions. You cannot prove you did not
|
|
26
|
+
edit a text file, and they cannot prove you did. Screenshots prove nothing. Logs you
|
|
27
|
+
control prove nothing, because you control them.
|
|
28
|
+
|
|
29
|
+
**AetherProof turns that into arithmetic that either checks or does not.**
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Use it
|
|
34
|
+
|
|
35
|
+
### Sign one output
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from aetherproof.auto import sign
|
|
39
|
+
|
|
40
|
+
resp = client.chat.completions.create(model="gpt-4o", messages=[...])
|
|
41
|
+
out = resp.choices[0].message.content
|
|
42
|
+
|
|
43
|
+
sign(prompt=user_prompt, output=out, model_id=resp.model)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
That is the whole integration. It never prompts, never blocks. On failure it
|
|
47
|
+
returns `None` and your program continues - set `AETHERPROOF_STRICT=1` if a missing
|
|
48
|
+
receipt should be an error instead.
|
|
49
|
+
|
|
50
|
+
### Wrap a function you already have
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from aetherproof.auto import receipted
|
|
54
|
+
|
|
55
|
+
@receipted(model_id="gpt-4o")
|
|
56
|
+
def ask(prompt: str) -> str:
|
|
57
|
+
return client.chat.completions.create(...).choices[0].message.content
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
No call sites change.
|
|
61
|
+
|
|
62
|
+
### A whole conversation, one signature
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from aetherproof.auto import AutoSession
|
|
66
|
+
|
|
67
|
+
with AutoSession(model_id="gpt-4o") as chat: # seals on exit
|
|
68
|
+
for prompt in prompts:
|
|
69
|
+
chat.turn(prompt=prompt, output=ask(prompt))
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
At 1,000 turns that is **one 412-byte seal**. Proving any single turn costs 10
|
|
73
|
+
hashes and about 1 KB, and reveals nothing about the other 999.
|
|
74
|
+
|
|
75
|
+
### From the command line
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
aetherproof sign model.onnx output.txt
|
|
79
|
+
aetherproof verify receipt.json --output output.txt
|
|
80
|
+
aetherproof # interactive menu
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**More recipes:** [docs/INTEGRATION.md](docs/INTEGRATION.md) - pick a path by one
|
|
84
|
+
question, every snippet tested.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Verify it
|
|
89
|
+
|
|
90
|
+
Verification needs **21 lines and one dependency**. No network, no account, no
|
|
91
|
+
special hardware, and it keeps working if this project is abandoned.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install cryptography # that is the entire requirement
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**The shape of it**, so you can see there is no trick - this is illustrative, not
|
|
98
|
+
complete:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
|
102
|
+
import json
|
|
103
|
+
|
|
104
|
+
r = json.load(open("receipt.json"))
|
|
105
|
+
pub = Ed25519PublicKey.from_public_bytes(bytes.fromhex(r["public_key"]))
|
|
106
|
+
|
|
107
|
+
# every field length-prefixed as "<len>:<field>", concatenated, then signed
|
|
108
|
+
preimage = build_preimage(r) # see the full version below
|
|
109
|
+
pub.verify(bytes.fromhex(r["signature"]), preimage) # raises if invalid
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **Do not ship the snippet above.** It omits `log_sequence`, `hw_evidence`, the
|
|
113
|
+
> v1.2 extension commitment, and the v1.3 `receipt_id` and `signing_key_id`, so it
|
|
114
|
+
> rejects every receipt the current version produces. The complete verifier - 21
|
|
115
|
+
> lines, tested on every commit against real receipts - is in
|
|
116
|
+
> **[docs/VERIFICATION.md](docs/VERIFICATION.md)**.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## What it proves
|
|
121
|
+
|
|
122
|
+
| Claim | Mechanism |
|
|
123
|
+
|---|---|
|
|
124
|
+
| This exact output was not modified after signing | `output_hash` inside the signed preimage |
|
|
125
|
+
| The receipt itself was not altered | Ed25519 over a length-prefixed canonical preimage |
|
|
126
|
+
| It was signed by the holder of a specific key | Ed25519 verify, no other input |
|
|
127
|
+
| A claimed time and log position were fixed at signing | both inside the preimage |
|
|
128
|
+
| The local log was not edited, reordered, or truncated in the middle | key-free hash chain |
|
|
129
|
+
| A specific turn belongs to a sealed session | Merkle inclusion proof, revealing no other turn |
|
|
130
|
+
| Anyone can check all of it offline, forever | receipt + public key, nothing else |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## What it does **not** prove
|
|
135
|
+
|
|
136
|
+
Read this before citing anything above.
|
|
137
|
+
|
|
138
|
+
**Integrity, not completeness.** *"Show me the record of this decision"* is answered.
|
|
139
|
+
*"Show me that you logged them all"* is not. Someone who logs 9,000 of 10,000
|
|
140
|
+
outputs passes every check here. That cannot be fixed locally - it needs an
|
|
141
|
+
independent witness, which does not exist yet.
|
|
142
|
+
|
|
143
|
+
| Not proven | Why |
|
|
144
|
+
|---|---|
|
|
145
|
+
| That the named model produced the output | it signs a `(model, output)` pair you supply |
|
|
146
|
+
| That the timestamp is truthful | it is your own clock - bound, not externally anchored |
|
|
147
|
+
| That the signing key is held securely | a software key on disk unless you set a passphrase |
|
|
148
|
+
| That it survives a quantum adversary | Python is Ed25519 only; ML-DSA-65 is in the Rust core |
|
|
149
|
+
|
|
150
|
+
**Where it does not fit at all:** detecting deepfakes or unsigned AI content. A
|
|
151
|
+
scammer never signs, so there is nothing to verify.
|
|
152
|
+
|
|
153
|
+
Full list: [docs/CLAIMS.md](docs/CLAIMS.md).
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Two implementations
|
|
158
|
+
|
|
159
|
+
| | Rust - `rust/` | Python - `aetherproof/` |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| Receipt | **128 B fixed binary** | 646 B JSON |
|
|
162
|
+
| Post-quantum | **ML-DSA-65 (FIPS 204)** | none |
|
|
163
|
+
| Secret zeroization, constant-time compare | **yes** | no |
|
|
164
|
+
| `unsafe` in production | **zero, compiler-enforced** | n/a |
|
|
165
|
+
| Tests | 59 | 642 (93% coverage) |
|
|
166
|
+
| Distribution | source + CI wheels | PyPI |
|
|
167
|
+
|
|
168
|
+
Measured, 50,000 leaves, medians of seven isolated runs: Rust builds a Merkle tree
|
|
169
|
+
in **28.16 ms** against Python's 102.71 ms (3.6x) and verifies a proof in
|
|
170
|
+
**3.93 µs** against 17.17 µs (4.4x).
|
|
171
|
+
|
|
172
|
+
The Rust core is optional. `aetherproof` does not import it and behaves identically
|
|
173
|
+
without it - enforced in CI. See [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
174
|
+
|
|
175
|
+
### Secrets that get wiped
|
|
176
|
+
|
|
177
|
+
A signing key held as a Python `bytes` object cannot be wiped - it is immutable, and
|
|
178
|
+
garbage collection does not overwrite the allocation. `SecureSigner` keeps the key
|
|
179
|
+
inside Rust and overwrites it on release, including when a block exits by exception.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
import _native
|
|
183
|
+
|
|
184
|
+
with _native.SecureSigner() as signer: # key wiped on exit
|
|
185
|
+
pub = signer.public_key() # nothing returns the secret
|
|
186
|
+
receipt = signer.sign_receipt(pid=1, binary=model_bytes,
|
|
187
|
+
memory_hash=0, syscall_count=1)
|
|
188
|
+
|
|
189
|
+
assert _native.SecureVerifier(pub).verify_receipt(receipt)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Setup and post-quantum usage: [docs/INTEGRATION.md](docs/INTEGRATION.md#path-c--secrets-that-get-wiped).
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Documentation
|
|
197
|
+
|
|
198
|
+
| | |
|
|
199
|
+
|---|---|
|
|
200
|
+
| [INTEGRATION.md](docs/INTEGRATION.md) | **start here** - pick a path by one question |
|
|
201
|
+
| [GETTING-STARTED.md](docs/GETTING-STARTED.md) | first receipt, no code |
|
|
202
|
+
| [CLAIMS.md](docs/CLAIMS.md) | what this proves and what it does not |
|
|
203
|
+
| [VERIFICATION.md](docs/VERIFICATION.md) | the offline verifier, in full |
|
|
204
|
+
| [CLOUD-MODELS.md](docs/CLOUD-MODELS.md) | local weights vs an API you do not control |
|
|
205
|
+
| [AGENT-CHAIN.md](docs/AGENT-CHAIN.md) | binding agent context (receipt v1.2) |
|
|
206
|
+
| [SECURITY.md](SECURITY.md) | reporting a vulnerability, threat model, known issues |
|
|
207
|
+
| [ROADMAP.md](docs/ROADMAP.md) | 0.5.x - Rust core, bindings, post-quantum |
|
|
208
|
+
| [ANALYSIS.md](docs/ANALYSIS.md) | measured assessment, including what is unverified |
|
|
209
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | extension and spec workflow |
|
|
210
|
+
| [RELEASE-NOTES-0.5.1.md](docs/RELEASE-NOTES-0.5.1.md) | what changed in 0.5.1 |
|
|
211
|
+
| [RELEASE-NOTES-0.4.0.md](docs/RELEASE-NOTES-0.4.0.md) | what changed in 0.4.0 |
|
|
212
|
+
| [agent-chain-context-response.md](docs/agent-chain-context-response.md) | the v1.2 design discussion, from issue #1 |
|
|
213
|
+
| [DEMO.md](docs/DEMO.md) | recording a walkthrough |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
**Apache-2.0.** Use it, deploy it, fork it, embed it in a commercial product - no
|
|
220
|
+
copyleft obligation. The receipt format and the offline verifier are meant to be
|
|
221
|
+
copied freely; a proof layer nobody can adopt is not a proof layer.
|
|
222
|
+
|
|
223
|
+
*Versions up to 0.2.2 were AGPL-3.0-or-later. From 0.3.0 onward: Apache-2.0.*
|
|
224
|
+
|
|
225
|
+
Security issues: **[SECURITY.md](SECURITY.md)** - please do not open a public issue.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""AetherProof
|
|
1
|
+
"""AetherProof - the open-source receipt engine. Prototype of Signet."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.
|
|
3
|
+
__version__ = "0.5.1"
|
|
4
4
|
__author__ = "Pulkit Srivastava"
|
|
5
5
|
|
|
6
6
|
from aetherproof.core.receipt import Receipt
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Headless AetherProof
|
|
1
|
+
"""Headless AetherProof - zero interaction, for automation.
|
|
2
2
|
|
|
3
3
|
The wizard and the CLI both assume a human at a terminal. That is the wrong
|
|
4
4
|
shape for where receipts actually need to be generated: a cloud coding model, a
|
|
@@ -19,7 +19,7 @@ Nothing in this module reads stdin or writes to stdout.
|
|
|
19
19
|
s.turn(prompt=..., output=...)
|
|
20
20
|
# seals on exit; s.seal_path holds the signed root
|
|
21
21
|
|
|
22
|
-
# wrap any client call
|
|
22
|
+
# wrap any client call - the lazy path
|
|
23
23
|
from aetherproof.auto import receipted
|
|
24
24
|
@receipted(model_id="gpt-4o")
|
|
25
25
|
def ask(prompt): return client.responses(prompt)
|
|
@@ -153,7 +153,7 @@ def sign(
|
|
|
153
153
|
|
|
154
154
|
`model_id` sets the honest tier automatically: given one, the root is
|
|
155
155
|
`api_attested` built from the id the provider returned; without one it is
|
|
156
|
-
`name_only`. Neither claims to bind the weights
|
|
156
|
+
`name_only`. Neither claims to bind the weights - that needs a local file.
|
|
157
157
|
"""
|
|
158
158
|
if is_disabled():
|
|
159
159
|
return None
|
|
@@ -275,7 +275,7 @@ class AutoSession:
|
|
|
275
275
|
return self
|
|
276
276
|
|
|
277
277
|
def __exit__(self, exc_type, exc, tb) -> bool:
|
|
278
|
-
# seal even when the caller's block raised
|
|
278
|
+
# seal even when the caller's block raised - a crashed run still wants
|
|
279
279
|
# a record of what it produced up to that point
|
|
280
280
|
self.close()
|
|
281
281
|
return False
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""CLI entry point
|
|
1
|
+
"""CLI entry point - bare interactive menu or direct subcommands."""
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import json
|
|
@@ -23,7 +23,7 @@ from .core.keystore import home, default_log, load_or_create_signer
|
|
|
23
23
|
def _app_state():
|
|
24
24
|
# persistent app signing key + transparency log (shared keystore).
|
|
25
25
|
# home() and default_log() resolve AETHERPROOF_HOME at call time and anchor
|
|
26
|
-
# the log to an ABSOLUTE path
|
|
26
|
+
# the log to an ABSOLUTE path - the old CWD-relative default gave you a
|
|
27
27
|
# different log per directory you happened to run from.
|
|
28
28
|
key_dir = home()
|
|
29
29
|
signer = load_or_create_signer(key_dir)
|
|
@@ -48,7 +48,7 @@ def _ask_text(message, default=""):
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
def run_expert_shell():
|
|
51
|
-
console.print("[dim]Expert shell
|
|
51
|
+
console.print("[dim]Expert shell - type a command, or 'exit' to return.[/dim]")
|
|
52
52
|
while True:
|
|
53
53
|
try:
|
|
54
54
|
line = console.input("[cyan bold]aetherproof>[/cyan bold] ").strip()
|
|
@@ -83,11 +83,11 @@ def run_keygen_wizard():
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
def _help_table():
|
|
86
|
-
table = Table(title="AetherProof
|
|
86
|
+
table = Table(title="AetherProof - commands", show_header=True, header_style="cyan")
|
|
87
87
|
table.add_column("Command")
|
|
88
88
|
table.add_column("Description")
|
|
89
89
|
table.add_row("aetherproof", "Launch the interactive menu")
|
|
90
|
-
table.add_row("sign <model> <output> [--input F]", "Sign a model output
|
|
90
|
+
table.add_row("sign <model> <output> [--input F]", "Sign a model output -> receipt")
|
|
91
91
|
table.add_row("verify <receipt> [--pubkey K] [--output F] [--quiet]", "Verify a receipt (+ output file) offline")
|
|
92
92
|
table.add_row("inspect <receipt>", "Show all receipt fields decoded")
|
|
93
93
|
table.add_row("log <list|verify|count>", "Inspect the transparency log")
|
|
@@ -81,7 +81,7 @@ def compute_merkle_root(hashes: List[str]) -> str:
|
|
|
81
81
|
as a leaf.
|
|
82
82
|
|
|
83
83
|
Empty list returns "". A single leaf returns its *tagged* hash, not the raw
|
|
84
|
-
input
|
|
84
|
+
input - returning the leaf unchanged would break property 2 for 1-file trees.
|
|
85
85
|
|
|
86
86
|
Args:
|
|
87
87
|
hashes: list of hex-encoded leaf hashes
|
|
@@ -113,7 +113,7 @@ def compute_model_weight_root(model_path: Union[str, Path], chunk_size: int = 40
|
|
|
113
113
|
For a single file, this is the file's SHA-256 (unchanged contract).
|
|
114
114
|
|
|
115
115
|
For a directory, each leaf commits to the file's **path as well as its
|
|
116
|
-
bytes
|
|
116
|
+
bytes**- `sha256("<relative/path>\\x00<digest>")`. v0.2.x hashed contents
|
|
117
117
|
only, so two directories holding the same bytes under different filenames
|
|
118
118
|
produced an identical root; renaming `weights.bin` to `config.json` was
|
|
119
119
|
invisible to the model-identity check. Paths are POSIX-normalised so a root
|
|
@@ -30,7 +30,7 @@ def log_path() -> Path:
|
|
|
30
30
|
"""The transparency log.
|
|
31
31
|
|
|
32
32
|
MUST be absolute. ReceiptLog's own default is "./receipts/log.db", which is
|
|
33
|
-
CWD-relative
|
|
33
|
+
CWD-relative - signing from two different directories produced two separate
|
|
34
34
|
logs, so the append-only chain silently forked per working directory and
|
|
35
35
|
neither log was complete.
|
|
36
36
|
"""
|
|
@@ -54,7 +54,7 @@ def __getattr__(name):
|
|
|
54
54
|
|
|
55
55
|
# Optional passphrase for the private key at rest. When set, the PEM is written
|
|
56
56
|
# with BestAvailableEncryption instead of NoEncryption. Left unset the key is
|
|
57
|
-
# still written 0600, but an attacker who can read the file can forge receipts
|
|
57
|
+
# still written 0600, but an attacker who can read the file can forge receipts -
|
|
58
58
|
# so the env var is the difference between "protected by file permissions" and
|
|
59
59
|
# "protected by a secret".
|
|
60
60
|
PASSPHRASE_ENV = "AETHERPROOF_KEY_PASSPHRASE"
|
|
@@ -73,7 +73,7 @@ def _passphrase() -> Optional[bytes]:
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
def _chmod_600(path: Path) -> None:
|
|
76
|
-
"""Owner-read/write only. Best effort
|
|
76
|
+
"""Owner-read/write only. Best effort - POSIX bits are advisory on Windows."""
|
|
77
77
|
try:
|
|
78
78
|
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
|
|
79
79
|
except OSError:
|
|
@@ -86,7 +86,7 @@ def load_or_create_signer(key_dir: Path = None) -> Signer:
|
|
|
86
86
|
Creation is an atomic O_EXCL claim rather than exists()-then-write. The old
|
|
87
87
|
check-then-create was a race: measured over 8 trials x 16 threads it handed
|
|
88
88
|
out 2-4 DISTINCT keys every single time, and the losing threads' public keys
|
|
89
|
-
were overwritten and never persisted
|
|
89
|
+
were overwritten and never persisted - making their receipts permanently
|
|
90
90
|
unverifiable. Now exactly one caller wins the create; everyone else falls
|
|
91
91
|
through and reads the winner's key.
|
|
92
92
|
"""
|
|
@@ -102,7 +102,7 @@ def load_or_create_signer(key_dir: Path = None) -> Signer:
|
|
|
102
102
|
candidate = Signer.generate()
|
|
103
103
|
pem = candidate.export_private_pem(password=pw)
|
|
104
104
|
try:
|
|
105
|
-
# O_EXCL is the atomic claim
|
|
105
|
+
# O_EXCL is the atomic claim - it fails if anyone else got here first.
|
|
106
106
|
fd = os.open(priv, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o600)
|
|
107
107
|
except FileExistsError:
|
|
108
108
|
# Lost the race: the winner's key is authoritative. Discard ours rather
|
|
@@ -163,7 +163,7 @@ def issue_receipt(
|
|
|
163
163
|
|
|
164
164
|
The log_sequence is reserved (max+1) and the log_anchor set BEFORE signing,
|
|
165
165
|
so both are covered by the signature. Files are written first; log.append is
|
|
166
|
-
the commit point
|
|
166
|
+
the commit point - on any failure the files are rolled back so nothing is
|
|
167
167
|
left orphaned. Raises ValueError on a concurrent sequence collision.
|
|
168
168
|
|
|
169
169
|
Passing `session_id` / `turn_index` / `session_root` binds this receipt to a
|
|
@@ -176,7 +176,7 @@ def issue_receipt(
|
|
|
176
176
|
receipts_dir = Path(receipts_dir) if receipts_dir else receipts_path()
|
|
177
177
|
receipts_dir.mkdir(parents=True, exist_ok=True)
|
|
178
178
|
|
|
179
|
-
# Assemble the signed extensions once
|
|
179
|
+
# Assemble the signed extensions once - every retry must sign the same
|
|
180
180
|
# context, or the receipt's identity would shift between attempts.
|
|
181
181
|
signed_ext = dict(extensions or {})
|
|
182
182
|
ctx = {}
|
|
@@ -190,7 +190,7 @@ def issue_receipt(
|
|
|
190
190
|
signed_ext.setdefault(SESSION_NS, {}).update(ctx)
|
|
191
191
|
|
|
192
192
|
# The sequence is inside the signing preimage, so it cannot be assigned
|
|
193
|
-
# after signing
|
|
193
|
+
# after signing - it has to be chosen, signed, and committed, and if another
|
|
194
194
|
# writer took that slot first the whole build must be redone. v0.2.2 tried
|
|
195
195
|
# once and gave up: 29 of 32 concurrent calls failed. Signing is ~45 us, so
|
|
196
196
|
# retrying is far cheaper than the lock it would otherwise need.
|