veridict-verify 0.2.0__py3-none-any.whl

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,11 @@
1
+ """Standalone offline verifier for VERIDICT case bundles.
2
+
3
+ This package intentionally shares no runtime code with the veridict engine:
4
+ it re-implements every check from the bundle specification so that a skeptic
5
+ does not have to trust the tool that produced the bundle.
6
+ """
7
+
8
+ __version__ = "0.2.0"
9
+
10
+ CURRENT_SPEC = "veridict-bundle/2"
11
+ SUPPORTED_SPECS = ("veridict-bundle/1", CURRENT_SPEC)
veridict_verify/cli.py ADDED
@@ -0,0 +1,83 @@
1
+ """veridict-verify: check a bundle you did not produce, on a machine you control.
2
+
3
+ Exit codes: 0 = VALID, 1 = INVALID, 2 = VALID WITH WARNINGS.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import argparse
9
+ import json
10
+ import sys
11
+ from pathlib import Path
12
+
13
+ from veridict_verify import __version__
14
+ from veridict_verify.verifier import verify_bundle
15
+
16
+
17
+ def main(argv: list[str] | None = None) -> int:
18
+ parser = argparse.ArgumentParser(
19
+ prog="veridict-verify",
20
+ description="Offline verifier for VERIDICT case bundles.",
21
+ )
22
+ parser.add_argument("bundle", help="path to a .veridict.zip bundle or unpacked bundle directory")
23
+ parser.add_argument("--json", action="store_true", help="emit a machine-readable JSON report")
24
+ parser.add_argument(
25
+ "--trusted-key",
26
+ action="append",
27
+ default=[],
28
+ metavar="FINGERPRINT_OR_PATH",
29
+ help=(
30
+ "pin an investigator key (full SHA-256 fingerprint, 16-char key id, "
31
+ "or path to a fingerprint/pubkey file). Repeatable. When set, any "
32
+ "manifest signer not in the trusted set is an error."
33
+ ),
34
+ )
35
+ parser.add_argument("--version", action="version", version=f"veridict-verify {__version__}")
36
+ args = parser.parse_args(argv)
37
+
38
+ bundle = Path(args.bundle)
39
+ if not bundle.exists():
40
+ print(f"error: no such file or directory: {bundle}", file=sys.stderr)
41
+ return 1
42
+
43
+ trusted = set(args.trusted_key) if args.trusted_key else None
44
+ report = verify_bundle(bundle, trusted_keys=trusted)
45
+
46
+ if args.json:
47
+ print(json.dumps(report.to_json(), indent=2))
48
+ else:
49
+ _print_human(report)
50
+
51
+ if report.errors:
52
+ return 1
53
+ if report.warnings:
54
+ return 2
55
+ return 0
56
+
57
+
58
+ def _print_human(report) -> None:
59
+ print(f"VERIDICT bundle verification - {report.bundle}")
60
+ print("=" * 72)
61
+ s = report.stats
62
+ if s:
63
+ print(
64
+ f"records: {s.get('records', 0)} (signed: {s.get('signed_records', 0)}) "
65
+ f"artifacts: {s.get('artifacts', 0)} claims: {s.get('claims', 0)} "
66
+ f"(human-verified: {s.get('verified_claims', 0)}) "
67
+ f"steps: {s.get('steps', 0)} (AI: {s.get('ai_steps', 0)})"
68
+ )
69
+ fps = s.get("signer_fingerprints") or {}
70
+ if fps:
71
+ print("signers:")
72
+ for key_id, fingerprint in sorted(fps.items()):
73
+ print(f" {key_id}: {fingerprint}")
74
+ print("-" * 72)
75
+ for f in report.findings:
76
+ tag = {"error": "FAIL", "warning": "WARN", "info": " ok"}[f.level]
77
+ print(f"[{tag}] {f.check}: {f.message}")
78
+ print("-" * 72)
79
+ print(f"VERDICT: {report.verdict}")
80
+
81
+
82
+ if __name__ == "__main__":
83
+ raise SystemExit(main())