actaseal-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.
- actaseal_verify-1.0.0/LICENSE +202 -0
- actaseal_verify-1.0.0/PKG-INFO +184 -0
- actaseal_verify-1.0.0/README.md +173 -0
- actaseal_verify-1.0.0/actaseal_verify.egg-info/PKG-INFO +184 -0
- actaseal_verify-1.0.0/actaseal_verify.egg-info/SOURCES.txt +14 -0
- actaseal_verify-1.0.0/actaseal_verify.egg-info/dependency_links.txt +1 -0
- actaseal_verify-1.0.0/actaseal_verify.egg-info/requires.txt +1 -0
- actaseal_verify-1.0.0/actaseal_verify.egg-info/top_level.txt +1 -0
- actaseal_verify-1.0.0/pyproject.toml +21 -0
- actaseal_verify-1.0.0/setup.cfg +4 -0
- actaseal_verify-1.0.0/tests/test_continuity_checkpoint.py +174 -0
- actaseal_verify-1.0.0/tests/test_json_bomb_and_malformed_packet_v1.py +94 -0
- actaseal_verify-1.0.0/tests/test_tamper_demo_js.py +100 -0
- actaseal_verify-1.0.0/tests/test_telemetry_wrapper_v1.py +53 -0
- actaseal_verify-1.0.0/tests/test_verify_demo_packet.py +212 -0
- actaseal_verify-1.0.0/verify.py +702 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: actaseal-verify
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Standalone offline verifier for ActaSeal dispute evidence packets
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: cryptography
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# actaseal-verify
|
|
13
|
+
|
|
14
|
+
Verify an ActaSeal dispute evidence packet yourself, in about 60 seconds,
|
|
15
|
+
without installing ActaSeal, without a network call, and without trusting
|
|
16
|
+
us. This repo is one script (`verify.py`) plus a spec.
|
|
17
|
+
|
|
18
|
+
Who this is for: an underwriter, dispute analyst, or auditor who has been
|
|
19
|
+
handed a packet (a `.zip`) and wants to check, independently, that:
|
|
20
|
+
|
|
21
|
+
- the evidence chain hasn't been tampered with (every event's hash
|
|
22
|
+
recomputes from its own recorded content, and the chain is unbroken);
|
|
23
|
+
- the receipt's signature is genuinely valid over that chain;
|
|
24
|
+
- the chain-of-custody and acquisition documents (the FRE 901/902 basis
|
|
25
|
+
for admissibility) are present and internally consistent;
|
|
26
|
+
- if the packet claims a payment-rail settlement anchor, that anchor's
|
|
27
|
+
hash actually recomputes from its declared content.
|
|
28
|
+
|
|
29
|
+
## Verify a packet in 60 seconds
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install cryptography # the only third-party dependency
|
|
33
|
+
unzip your-packet.zip -d packet
|
|
34
|
+
python verify.py packet
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
(Or `pip install .` from this repo, then `python -m verify packet`.)
|
|
38
|
+
|
|
39
|
+
Exit code `0` and `VERIFIED: ...` means every check above passed. Exit
|
|
40
|
+
code `1` prints exactly which check failed and why -- nothing is silently
|
|
41
|
+
waved through. Exit code `2` means `cryptography` isn't installed (no
|
|
42
|
+
partial/soft-pass is possible).
|
|
43
|
+
|
|
44
|
+
Try it right now against the demo packets checked into this repo:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python verify.py demo/demo-packet-unanchored
|
|
48
|
+
python verify.py demo/demo-packet-anchored # includes a rail settlement anchor
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or try it entirely in your browser, no install: **[tamper_demo/](tamper_demo/index.html)**
|
|
52
|
+
loads a real signed packet, lets you edit any field, and re-verifies live as you type --
|
|
53
|
+
break the hash chain or the signature and watch it turn red immediately. Nothing is sent
|
|
54
|
+
anywhere; it's a JS port of the same checks (`tamper_demo/verify_min.js`), using the
|
|
55
|
+
browser's native WebCrypto Ed25519 support.
|
|
56
|
+
|
|
57
|
+
## Use it in CI
|
|
58
|
+
|
|
59
|
+
`action.yml` in this repository is a reusable GitHub Action:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
- uses: actaseal/actaseal-verify@main
|
|
63
|
+
with:
|
|
64
|
+
packet-dir: ./extracted-packet
|
|
65
|
+
# anchors: ./anchors.jsonl # optional
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Fails the step (non-zero exit) if the packet doesn't verify.
|
|
69
|
+
|
|
70
|
+
## Use it from Node / a browser
|
|
71
|
+
|
|
72
|
+
`@actaseal/verify` (`tamper_demo/`, `npm install @actaseal/verify`) is a
|
|
73
|
+
minimal, zero-dependency WebCrypto port covering chain integrity and
|
|
74
|
+
Ed25519 receipt signatures only -- see `tamper_demo/README.npm.md` for
|
|
75
|
+
its exact (reduced) scope before relying on it for anything beyond a
|
|
76
|
+
quick client-side check. The real `verify.py` above is the canonical,
|
|
77
|
+
full-scope verifier.
|
|
78
|
+
|
|
79
|
+
## Telemetry: opt-in, count-only, off by default, NOT in verify.py itself
|
|
80
|
+
|
|
81
|
+
`verify.py` makes zero network calls, period -- that's a real,
|
|
82
|
+
tested guarantee (`tests/test_verify_demo_packet.py::
|
|
83
|
+
test_verify_has_no_external_imports_beyond_cryptography`), not a
|
|
84
|
+
default that can be toggled. Telemetry lives entirely in a separate,
|
|
85
|
+
optional wrapper instead: `verify_with_telemetry.py` calls `verify.py`'s
|
|
86
|
+
own `main()` completely unchanged, and only after that call returns
|
|
87
|
+
does it (optionally) send a ping -- `verify.py` itself never imports
|
|
88
|
+
`urllib` or knows telemetry exists.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
python verify_with_telemetry.py --telemetry <packet_dir>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Even with `--telemetry` passed, the wrapper ships with
|
|
95
|
+
`TELEMETRY_ENDPOINT` set to an empty string, so it's currently an inert
|
|
96
|
+
no-op regardless -- nothing is transmitted until a maintainer
|
|
97
|
+
deliberately sets a real endpoint in a future release. When/if that
|
|
98
|
+
happens, a ping sends exactly three fields: the wrapper's own version
|
|
99
|
+
string, the verification outcome (`PASS`/`FAIL`), and a failure count
|
|
100
|
+
(derived by counting verify.py's own printed failure lines, never by
|
|
101
|
+
inspecting packet content) -- never a filename, never anything about
|
|
102
|
+
the specific receipt or ledger being verified. Best-effort only: any
|
|
103
|
+
network failure is silently swallowed and never affects the exit code
|
|
104
|
+
or printed result, which are always exactly what plain `python verify.py`
|
|
105
|
+
would have produced.
|
|
106
|
+
|
|
107
|
+
## Why "zero-import" is the whole point
|
|
108
|
+
|
|
109
|
+
`verify.py` has no dependency on ActaSeal's code, config, database, or
|
|
110
|
+
network access -- it is standalone by construction (see the assertion in
|
|
111
|
+
`tests/test_verify_demo_packet.py::test_verify_has_no_external_imports_beyond_cryptography`).
|
|
112
|
+
The only third-party package it needs is `cryptography`, for Ed25519/ECDSA
|
|
113
|
+
signature checks. That means:
|
|
114
|
+
|
|
115
|
+
- you can read the whole verifier in one sitting (~360 lines, no
|
|
116
|
+
framework, no magic) and know exactly what it checks;
|
|
117
|
+
- you never run vendor code against your own systems to check evidence
|
|
118
|
+
someone handed you -- it only reads files from the packet directory;
|
|
119
|
+
- the packet embeds its own trust root (`manifest.json`'s
|
|
120
|
+
`receipt_public_key_hex`) -- verification needs no external key file,
|
|
121
|
+
registry, or live service lookup. You separately compare that key
|
|
122
|
+
against the operator's published key out of band; the packet cannot
|
|
123
|
+
forge that comparison, only be internally consistent or not.
|
|
124
|
+
|
|
125
|
+
This is the file that ships inside every real ActaSeal dispute packet as
|
|
126
|
+
`verify.py` -- what you're running here is not a simplified demo version,
|
|
127
|
+
it's the literal artifact.
|
|
128
|
+
|
|
129
|
+
## What "VERIFIED" actually means
|
|
130
|
+
|
|
131
|
+
Passing does not mean "ActaSeal says this is fine." It means every one of
|
|
132
|
+
these independently re-derives from data already inside the packet:
|
|
133
|
+
|
|
134
|
+
1. **Ledger chain integrity** -- each event's `payload_hash`, `event_id`,
|
|
135
|
+
and `event_hash` recompute from that event's own fields; the slice is
|
|
136
|
+
an unbroken hash chain from the manifest's declared starting point.
|
|
137
|
+
2. **Receipt signature** -- the receipt's Ed25519/ECDSA signature verifies
|
|
138
|
+
against `manifest.json`'s embedded public key, over the canonical JSON
|
|
139
|
+
of the receipt (minus the signature field itself).
|
|
140
|
+
3. **Receipt-to-chain binding** -- the receipt's `ledger_entry_hash` names
|
|
141
|
+
a real event in the slice, for the same action, and that event's
|
|
142
|
+
recorded action hash matches the receipt's.
|
|
143
|
+
4. **Chain-of-custody / acquisition basis (FRE 901(b)(9), 902(13)-(14))**
|
|
144
|
+
-- the acquisition report names its tool, clock source, and custodian;
|
|
145
|
+
custody events are time-ordered and each bound to a real ledger event
|
|
146
|
+
hash; the authentication statement's key id, pubkey hash, and mandate
|
|
147
|
+
hash match the receipt.
|
|
148
|
+
5. **Scope conformance** -- if the receipt claims an in-scope or breach
|
|
149
|
+
verdict, that verdict traces back to a `ScopeEvaluated` ledger event
|
|
150
|
+
whose recorded scope/action hashes recompute correctly.
|
|
151
|
+
6. **Settlement anchor** -- if the packet claims a payment-rail
|
|
152
|
+
settlement anchor, its `anchor_hash` recomputes from the anchor
|
|
153
|
+
content; an unanchored packet says so explicitly (never silent).
|
|
154
|
+
|
|
155
|
+
See [`SPEC.md`](SPEC.md) for the full packet format.
|
|
156
|
+
|
|
157
|
+
## What this does *not* verify
|
|
158
|
+
|
|
159
|
+
- That the underlying transaction/refund/decision was *correct* -- only
|
|
160
|
+
that the recorded evidence is internally consistent and unaltered.
|
|
161
|
+
- That `receipt_public_key_hex` belongs to the operator you think it
|
|
162
|
+
does -- that binding is on you, out of band (e.g. compare against a
|
|
163
|
+
key the operator has published elsewhere).
|
|
164
|
+
- Anything about a deployment you haven't been handed a packet from.
|
|
165
|
+
|
|
166
|
+
## Repo layout
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
verify.py the verifier -- the only file that matters at verify time
|
|
170
|
+
generate_demo_packet.py builds the two demo packets below, from scratch, standalone
|
|
171
|
+
demo/demo-packet-unanchored/ a valid packet with no settlement anchor
|
|
172
|
+
demo/demo-packet-anchored/ a valid packet with a payment-rail settlement anchor
|
|
173
|
+
tamper_demo/ in-browser, editable, live-verifying demo (see above)
|
|
174
|
+
SPEC.md packet format reference
|
|
175
|
+
tests/ pytest suite: valid packets pass, tampered ones fail loudly
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
181
|
+
|
|
182
|
+
## Security
|
|
183
|
+
|
|
184
|
+
See [SECURITY.md](SECURITY.md) for how to report a vulnerability.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# actaseal-verify
|
|
2
|
+
|
|
3
|
+
Verify an ActaSeal dispute evidence packet yourself, in about 60 seconds,
|
|
4
|
+
without installing ActaSeal, without a network call, and without trusting
|
|
5
|
+
us. This repo is one script (`verify.py`) plus a spec.
|
|
6
|
+
|
|
7
|
+
Who this is for: an underwriter, dispute analyst, or auditor who has been
|
|
8
|
+
handed a packet (a `.zip`) and wants to check, independently, that:
|
|
9
|
+
|
|
10
|
+
- the evidence chain hasn't been tampered with (every event's hash
|
|
11
|
+
recomputes from its own recorded content, and the chain is unbroken);
|
|
12
|
+
- the receipt's signature is genuinely valid over that chain;
|
|
13
|
+
- the chain-of-custody and acquisition documents (the FRE 901/902 basis
|
|
14
|
+
for admissibility) are present and internally consistent;
|
|
15
|
+
- if the packet claims a payment-rail settlement anchor, that anchor's
|
|
16
|
+
hash actually recomputes from its declared content.
|
|
17
|
+
|
|
18
|
+
## Verify a packet in 60 seconds
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install cryptography # the only third-party dependency
|
|
22
|
+
unzip your-packet.zip -d packet
|
|
23
|
+
python verify.py packet
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
(Or `pip install .` from this repo, then `python -m verify packet`.)
|
|
27
|
+
|
|
28
|
+
Exit code `0` and `VERIFIED: ...` means every check above passed. Exit
|
|
29
|
+
code `1` prints exactly which check failed and why -- nothing is silently
|
|
30
|
+
waved through. Exit code `2` means `cryptography` isn't installed (no
|
|
31
|
+
partial/soft-pass is possible).
|
|
32
|
+
|
|
33
|
+
Try it right now against the demo packets checked into this repo:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python verify.py demo/demo-packet-unanchored
|
|
37
|
+
python verify.py demo/demo-packet-anchored # includes a rail settlement anchor
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or try it entirely in your browser, no install: **[tamper_demo/](tamper_demo/index.html)**
|
|
41
|
+
loads a real signed packet, lets you edit any field, and re-verifies live as you type --
|
|
42
|
+
break the hash chain or the signature and watch it turn red immediately. Nothing is sent
|
|
43
|
+
anywhere; it's a JS port of the same checks (`tamper_demo/verify_min.js`), using the
|
|
44
|
+
browser's native WebCrypto Ed25519 support.
|
|
45
|
+
|
|
46
|
+
## Use it in CI
|
|
47
|
+
|
|
48
|
+
`action.yml` in this repository is a reusable GitHub Action:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
- uses: actaseal/actaseal-verify@main
|
|
52
|
+
with:
|
|
53
|
+
packet-dir: ./extracted-packet
|
|
54
|
+
# anchors: ./anchors.jsonl # optional
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Fails the step (non-zero exit) if the packet doesn't verify.
|
|
58
|
+
|
|
59
|
+
## Use it from Node / a browser
|
|
60
|
+
|
|
61
|
+
`@actaseal/verify` (`tamper_demo/`, `npm install @actaseal/verify`) is a
|
|
62
|
+
minimal, zero-dependency WebCrypto port covering chain integrity and
|
|
63
|
+
Ed25519 receipt signatures only -- see `tamper_demo/README.npm.md` for
|
|
64
|
+
its exact (reduced) scope before relying on it for anything beyond a
|
|
65
|
+
quick client-side check. The real `verify.py` above is the canonical,
|
|
66
|
+
full-scope verifier.
|
|
67
|
+
|
|
68
|
+
## Telemetry: opt-in, count-only, off by default, NOT in verify.py itself
|
|
69
|
+
|
|
70
|
+
`verify.py` makes zero network calls, period -- that's a real,
|
|
71
|
+
tested guarantee (`tests/test_verify_demo_packet.py::
|
|
72
|
+
test_verify_has_no_external_imports_beyond_cryptography`), not a
|
|
73
|
+
default that can be toggled. Telemetry lives entirely in a separate,
|
|
74
|
+
optional wrapper instead: `verify_with_telemetry.py` calls `verify.py`'s
|
|
75
|
+
own `main()` completely unchanged, and only after that call returns
|
|
76
|
+
does it (optionally) send a ping -- `verify.py` itself never imports
|
|
77
|
+
`urllib` or knows telemetry exists.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python verify_with_telemetry.py --telemetry <packet_dir>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Even with `--telemetry` passed, the wrapper ships with
|
|
84
|
+
`TELEMETRY_ENDPOINT` set to an empty string, so it's currently an inert
|
|
85
|
+
no-op regardless -- nothing is transmitted until a maintainer
|
|
86
|
+
deliberately sets a real endpoint in a future release. When/if that
|
|
87
|
+
happens, a ping sends exactly three fields: the wrapper's own version
|
|
88
|
+
string, the verification outcome (`PASS`/`FAIL`), and a failure count
|
|
89
|
+
(derived by counting verify.py's own printed failure lines, never by
|
|
90
|
+
inspecting packet content) -- never a filename, never anything about
|
|
91
|
+
the specific receipt or ledger being verified. Best-effort only: any
|
|
92
|
+
network failure is silently swallowed and never affects the exit code
|
|
93
|
+
or printed result, which are always exactly what plain `python verify.py`
|
|
94
|
+
would have produced.
|
|
95
|
+
|
|
96
|
+
## Why "zero-import" is the whole point
|
|
97
|
+
|
|
98
|
+
`verify.py` has no dependency on ActaSeal's code, config, database, or
|
|
99
|
+
network access -- it is standalone by construction (see the assertion in
|
|
100
|
+
`tests/test_verify_demo_packet.py::test_verify_has_no_external_imports_beyond_cryptography`).
|
|
101
|
+
The only third-party package it needs is `cryptography`, for Ed25519/ECDSA
|
|
102
|
+
signature checks. That means:
|
|
103
|
+
|
|
104
|
+
- you can read the whole verifier in one sitting (~360 lines, no
|
|
105
|
+
framework, no magic) and know exactly what it checks;
|
|
106
|
+
- you never run vendor code against your own systems to check evidence
|
|
107
|
+
someone handed you -- it only reads files from the packet directory;
|
|
108
|
+
- the packet embeds its own trust root (`manifest.json`'s
|
|
109
|
+
`receipt_public_key_hex`) -- verification needs no external key file,
|
|
110
|
+
registry, or live service lookup. You separately compare that key
|
|
111
|
+
against the operator's published key out of band; the packet cannot
|
|
112
|
+
forge that comparison, only be internally consistent or not.
|
|
113
|
+
|
|
114
|
+
This is the file that ships inside every real ActaSeal dispute packet as
|
|
115
|
+
`verify.py` -- what you're running here is not a simplified demo version,
|
|
116
|
+
it's the literal artifact.
|
|
117
|
+
|
|
118
|
+
## What "VERIFIED" actually means
|
|
119
|
+
|
|
120
|
+
Passing does not mean "ActaSeal says this is fine." It means every one of
|
|
121
|
+
these independently re-derives from data already inside the packet:
|
|
122
|
+
|
|
123
|
+
1. **Ledger chain integrity** -- each event's `payload_hash`, `event_id`,
|
|
124
|
+
and `event_hash` recompute from that event's own fields; the slice is
|
|
125
|
+
an unbroken hash chain from the manifest's declared starting point.
|
|
126
|
+
2. **Receipt signature** -- the receipt's Ed25519/ECDSA signature verifies
|
|
127
|
+
against `manifest.json`'s embedded public key, over the canonical JSON
|
|
128
|
+
of the receipt (minus the signature field itself).
|
|
129
|
+
3. **Receipt-to-chain binding** -- the receipt's `ledger_entry_hash` names
|
|
130
|
+
a real event in the slice, for the same action, and that event's
|
|
131
|
+
recorded action hash matches the receipt's.
|
|
132
|
+
4. **Chain-of-custody / acquisition basis (FRE 901(b)(9), 902(13)-(14))**
|
|
133
|
+
-- the acquisition report names its tool, clock source, and custodian;
|
|
134
|
+
custody events are time-ordered and each bound to a real ledger event
|
|
135
|
+
hash; the authentication statement's key id, pubkey hash, and mandate
|
|
136
|
+
hash match the receipt.
|
|
137
|
+
5. **Scope conformance** -- if the receipt claims an in-scope or breach
|
|
138
|
+
verdict, that verdict traces back to a `ScopeEvaluated` ledger event
|
|
139
|
+
whose recorded scope/action hashes recompute correctly.
|
|
140
|
+
6. **Settlement anchor** -- if the packet claims a payment-rail
|
|
141
|
+
settlement anchor, its `anchor_hash` recomputes from the anchor
|
|
142
|
+
content; an unanchored packet says so explicitly (never silent).
|
|
143
|
+
|
|
144
|
+
See [`SPEC.md`](SPEC.md) for the full packet format.
|
|
145
|
+
|
|
146
|
+
## What this does *not* verify
|
|
147
|
+
|
|
148
|
+
- That the underlying transaction/refund/decision was *correct* -- only
|
|
149
|
+
that the recorded evidence is internally consistent and unaltered.
|
|
150
|
+
- That `receipt_public_key_hex` belongs to the operator you think it
|
|
151
|
+
does -- that binding is on you, out of band (e.g. compare against a
|
|
152
|
+
key the operator has published elsewhere).
|
|
153
|
+
- Anything about a deployment you haven't been handed a packet from.
|
|
154
|
+
|
|
155
|
+
## Repo layout
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
verify.py the verifier -- the only file that matters at verify time
|
|
159
|
+
generate_demo_packet.py builds the two demo packets below, from scratch, standalone
|
|
160
|
+
demo/demo-packet-unanchored/ a valid packet with no settlement anchor
|
|
161
|
+
demo/demo-packet-anchored/ a valid packet with a payment-rail settlement anchor
|
|
162
|
+
tamper_demo/ in-browser, editable, live-verifying demo (see above)
|
|
163
|
+
SPEC.md packet format reference
|
|
164
|
+
tests/ pytest suite: valid packets pass, tampered ones fail loudly
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
170
|
+
|
|
171
|
+
## Security
|
|
172
|
+
|
|
173
|
+
See [SECURITY.md](SECURITY.md) for how to report a vulnerability.
|