#!/usr/bin/env python3
"""Verify the integration evidence bundle offline. Imports no CAIN code."""
import json, subprocess, sys
from pathlib import Path
here=Path(__file__).resolve().parent
ok=True
for name in ("splunk.json","sentinel.json","prisma.json","zenity.json"):
    json.loads((here/"samples"/name).read_text()); print("PASS json", name)
cef=(here/"samples"/"cef.txt").read_text(); print("PASS cef", cef.startswith("CEF:0|CAIN|TrustFabric|")); ok &= cef.startswith("CEF:0|CAIN|TrustFabric|")
leef=(here/"samples"/"leef.txt").read_text(); print("PASS leef", leef.startswith("LEEF:2.0|CAIN|TrustFabric|")); ok &= leef.startswith("LEEF:2.0|CAIN|TrustFabric|")
ov=here/"overlay"; pub=json.loads((ov/"public_key.json").read_text())["public_key_b64"]
r=subprocess.run([sys.executable,"verify_offline.py","--pinned-pub",pub],cwd=str(ov))
print("PASS overlay" if r.returncode==0 else "FAIL overlay"); ok &= r.returncode==0
print("RESULT:", "VERIFIED" if ok else "NOT VERIFIED")
sys.exit(0 if ok else 1)
