Metadata-Version: 2.4
Name: scitt-time-anchor
Version: 3.0.0
Summary: Clean-room zero-dependency Python verifier for draft-fassbender-scitt-time-anchor-08 and strict consensus profile
Author: Shady Ismail
License-Expression: Apache-2.0
Project-URL: Homepage, https://shady-ismail-titan.github.io/scitt-time-anchor-ietf127/
Project-URL: Repository, https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127
Project-URL: Issues, https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/issues
Project-URL: Changelog, https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/blob/main/CHANGELOG.md
Keywords: ietf,scitt,opentimestamps,cose,cbor,bitcoin,rfc9942,rfc9943
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# SCITT Time-Anchor Triple-Engine Verifier (`v3.0.0`)

[![CI](https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/actions/workflows/ci.yml/badge.svg)](https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/actions/workflows/ci.yml)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/17201/badge)](https://www.bestpractices.dev/projects/17201)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/shady-ismail-titan/scitt-time-anchor-ietf127/badge)](https://scorecard.dev/viewer/?uri=github.com/shady-ismail-titan/scitt-time-anchor-ietf127)
[![REUSE Compliance](https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/actions/workflows/reuse.yml/badge.svg)](https://api.reuse.software/info/github.com/shady-ismail-titan/scitt-time-anchor-ietf127)
[![SWH](https://archive.softwareheritage.org/badge/swh:1:snp:fbd4659cafd38bc3d3c2009a97a3006530446640/)](https://archive.softwareheritage.org/swh:1:snp:fbd4659cafd38bc3d3c2009a97a3006530446640)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/blob/main/LICENSE)

**Zero-Backend Offline Browser WASM Lab:** [https://shady-ismail-titan.github.io/scitt-time-anchor-ietf127/](https://shady-ismail-titan.github.io/scitt-time-anchor-ietf127/)  
**Permanent UNESCO Software Heritage Snapshot:** [`swh:1:snp:fbd4659cafd38bc3d3c2009a97a3006530446640`](https://archive.softwareheritage.org/swh:1:snp:fbd4659cafd38bc3d3c2009a97a3006530446640)

> **Verification Scope Boundary:** `scitt-time-anchor` verifies Bitcoin-anchored temporal inclusion (`verification_scope: "temporal_anchor_only"`, `cose_signature_verified: false`). Cryptographic COSE signature verification is delegated to your SCITT verifier / Trust Store per [`THREAT_MODEL.md`](https://github.com/shady-ismail-titan/scitt-time-anchor-ietf127/blob/main/THREAT_MODEL.md).

Independent clean-room reference verifiers for `draft-fassbender-scitt-time-anchor-08` implemented in Python 3, safe Rust (`#![forbid(unsafe_code)]`), and offline WebAssembly (`wasm32-unknown-unknown`), paired with Z3 SMT invariant proofs, a 64-variant `draft-templeman-scitt-framing-space-01` CBOR framing-space empirical study, a reproducible multi-vendor interoperability harness, and non-normative implementer feedback for the IETF SCITT Working Group.

The baseline `--mode draft08` profile implements the exact 11-step `VERIFY-ANCHOR` algorithm as the default for backward compatibility with deployed OpenTimestamps v1 proofs. The opt-in `--mode strict` profile enforces Bitcoin Mainnet consensus target/retarget constraints, `min_confirmations >= 6`, RFC 8259 / I-JSON parsing parity, RFC 8949 / RFC 9052 Section 3 deterministic CBOR rules, and hardened OTS wire bounds.

## Architecture & Execution Targets

- **`scitt_time_anchor_py/` (`scitt-time-anchor` `3.0.0`)**: Pure Python 3 (`>= 3.10`) standard-library package with `0` runtime dependencies, PEP 621 packaging (`pyproject.toml`), and console entrypoint `scitt-time-anchor`.
- **`scitt_time_anchor_rs/` (`scitt_time_anchor_rs` `3.0.0`)**: Safe Rust CLI and library (`#![forbid(unsafe_code)]`, `0` external crate dependencies, zero Clippy warnings under `-D warnings`) using an explicit iterative `O(1)` call-stack work loop and exact 256-bit `U256` arithmetic.
- **`web/scitt_time_anchor.wasm` (`scitt_time_anchor_wasm` `3.0.0`)**: Zero-import offline `wasm32-unknown-unknown` build (`176,562` bytes raw / `58,630` bytes gzipped, `0` host imports, enforced under `Content-Security-Policy: connect-src 'none'`, bit-for-bit reproducible under `SOURCE_DATE_EPOCH`; SHA-256 recorded in [`VERIFICATION_MASTER_SUMMARY.json`](./VERIFICATION_MASTER_SUMMARY.json) and [`SHA256SUMS.txt`](./SHA256SUMS.txt)).
- **Two Verification Profiles (100% Backward-Compatible Default)**:
  - `--mode draft08` (default): Executes the baseline 11-step `VERIFY-ANCHOR` algorithm across Appendix D.1–D.7 and wild post-2016 Bitcoin `OP_RETURN` `.ots` proofs without breaking existing calendars or v1 receipts.
  - `--mode strict`: Opt-in hardened verification profile enforcing Bitcoin Mainnet `powLimit` (`0x1d00ffff`), an empirical post-height-419,328 difficulty policy floor (`0x181fffff`, tighter than every Mainnet block since BIP-113 activation in 2016), `2016`-block `4x` retarget clamping, `min_confirmations >= 6`, RFC 8259 / I-JSON JSONL parity, RFC 8949 deterministic CBOR with a strict deterministic-encoding policy rejecting `b"\xa0"` in favor of RFC 9052 Section 3's canonical zero-length `b""`, canonical `<= 5`-octet `u32` LEB128 varuints, `{0x08, 0xf0, 0xf1}` opcode allowlists, `MAX_RUNNING_BYTES = 4096`, and `BIP-113` / `Forward-MTP(H+5)` temporal monotonicity.

## What Changed in `v3.0.0` (Zero-Trust & Multi-Wave Red-Team Hardening)

1. **Fail-Closed Protocol, `--lock-mode` Policy Lock, Exact Bitcoin Header Consensus & Triple-Engine JSON Parity (`N35`–`N44`)**:
   - Both `cbor_scitt.py` and `cbor.rs` fail closed (`None`) whenever unprotected header `394` or `"scitt_receipt"` is present yet malformed even with `require_receipt=false` (`N37`) or explicit `receipt_bytes` override in `strict` (`N44B`); `bitcoin.rs` and `bitcoin_chain.py` reject duplicate `block_hash_internal` replay across heights in sparse slices (`N41`), enforce exact compact `nBits` immutability mid-epoch (`N43A`, rejecting compact target aliases such as `0x18010000` vs `0x19000100`), and enforce Bitcoin Core's exact `GetMedianTimePast` header rule over the preceding `min(h, 11)` ancestors from Block 1 onward (`N43B`, `N44A`).
   - Added `--lock-mode` to both Python (`scitt-time-anchor`) and Rust (`scitt_time_anchor_rs`) CLIs so operators ingesting untrusted JSONL can reject per-case `"mode"` downgrade attempts at Step 0 (`N42`).
   - Synchronized strict RFC 8259 `\uXXXX` hex validation (`N40`), recursive nested-array lone-surrogate rejection (`N35`), byte-exact UTF-8/`\b`/`\f` serialization (`N36`), Step-0 fail-closed JSONL schema validation (`N38`), non-negative height & strict 160-hex validation (`N39`), and zero production `assert` statements (`python3 -OO` verified across Python `3.11`–`3.15`).
   - `scitt_time_anchor_rs` rejects unrecognized CLI flags and missing `--mode` operands with exit `2`; `wasm_api.rs` enforces invalid mode rejection, `MAX_WASM_JSONL_LINES = 4_096`, `MAX_WASM_OUTPUT_BYTES = 16 MiB`, `MAX_BASE64_INPUT_BYTES = 8 MiB`, per-line UTF-8 parity, bounded Dissector payloads, and crate-wide `TEST_LOCK` concurrency safety (`14/14` Rust tests).
2. **IETF 127 Blind Salted-Commitment Pack (`spec_vectors/blind_vectors_*`, `verify_blind_pack.py`)**:
   - Publishes 24 opaque-ID (`BLIND-01`–`BLIND-24`) input-only vectors strictly separated from domain-separated SHA-256 salted verdict commitments with raw-byte cross-engine verification, an external `--cmd` verification & JSON attestation runner, and a full commit-and-reveal private challenge workflow (`--generate-private-challenge` minting fresh CSPRNG-nonce unseen vectors with `0o600` private salts + `--verify-private-challenge`).
3. **Allowlist-Only Strict Local Server, Isolated SLSA L3 Releases, OIDC PyPI & Offline Craft (`web/`, `.github/workflows/`)**:
   - Hardened `web/server.py` with explicit `ALLOWED_FILES` allowlist, strict `--prefix` 404 isolation, origin-form / `//` path rejection (`400`), RFC 9110 bodyless `204`/`HEAD`, explicit `405 Method Not Allowed` + `Allow: GET, HEAD` on all disallowed methods, `9/9` OWASP security headers (including `COEP: require-corp`, `base-uri 'none'`, non-leaky `Server` header) on every response including error paths, and `15s` socket timeout.
   - Split both `.github/workflows/release.yml` and `.github/workflows/publish-pypi.yml` into read-only `build-and-verify` and isolated attestation/publishing jobs with cross-job SHA-256 verification and `concurrency:` guards; added `--locked` to Cargo CI/release commands; staged `release.yml` as `draft: true` so human publication triggers PyPI OIDC cleanly; unified full sdist+wheel archive forensics across `ci.yml`, `release.yml`, and `publish-pypi.yml`; and added exact `SCITT_WASM_HEX`/`SCITT_WASM_META` checks in `pages.yml`.
   - Bundled self-hosted `OFL-1.1` `.woff2` typography (`Geist` + `IBM Plex Mono`, canonical SPDX `LICENSES/OFL-1.1.txt`, `0` external requests, FSFE REUSE 3.3 compliant), upgraded mobile `390px` 4-tab navigation (`2x2` grid, `>= 44px`), fixed `deriveStepTrace` (`steps 0..=11`) and `!explorerOnly` raw-JSONL guard, added PEP 561 `py.typed`, upgraded `SECURITY.md` to EU CRA Art. 14 **24-hour** early-warning SLA, and upgraded `sbom.cdx.json` to **CycloneDX 1.6**.

## Verified Conformance & Formal Audit Summary

Authoritative machine-verified `v3.0.0` counts and hashes are recorded in [`VERIFICATION_MASTER_SUMMARY.json`](./VERIFICATION_MASTER_SUMMARY.json) and [`SHA256SUMS.txt`](./SHA256SUMS.txt).

| Suite / Artifact | Target | Verified Posture |
| :--- | :--- | :--- |
| Rust Core Library (`cargo test --locked --release --lib` & `clippy -D warnings`) | `scitt_time_anchor_rs` (`#![forbid(unsafe_code)]`) | `14/14` PASS (`25/25` parallel runs), `0` warnings, `0` unsafe blocks |
| Appendix D + Strict Witness Conformance (`test_appendix_d_conformance.py`) | Dual-profile (`draft08` + `strict`, `N1`–`N44`) | `148/148` PASS, `0` Python/Rust/WASM divergences |
| Blind Salted-Commitment Pack (`verify_blind_pack.py`) | `24` opaque-ID (`BLIND-01`–`BLIND-24`) input-only vectors | `24/24` PASS across Python/Rust/WASM (`0` divergences, `0` verdict hints) |
| CBOR Framing-Space Study (`experiment_cbor_framing_space_64.py`) | `64` `draft-templeman-scitt-framing-space-01` variants | `1/64` canonical accepted (`63/64` rejected), `266/266` cases `0` divergences |
| Microsoft Z3 Formal SMT Audit (`prove_z3_invariants.py`) | Protocol findings & soundness theorems | `11/11` VERIFIED (`UNSAT` strict invariants) |
| Triple-Engine Differential (`run_50k_triple_differential.py`) | `20` vector families (`Python == Rust == WASM`) | `50,000/50,000` PASS, `0` divergences |
| Adversarial Mutation Fuzz (`test_100k_mutation_fuzz.py`) | Hostile OTS, CBOR/COSE & header chains | `100,000/100,000` PASS, `0` crashes, `0` divergences |
| WASM Memory Leak Sieve (`wasm_100k_leak_runner.mjs`) | Single `WebAssembly.Instance` (`100k + 20k` calls) | `120,000` calls, `0` B steady-state heap delta |
| OpenSSF Gold Reproducible WASM Build (`ci.yml`) | Independent dual-target `wasm32-unknown-unknown` builds | Bit-for-bit identical `sha256sum` under `SOURCE_DATE_EPOCH` |
| Multi-Vendor Interop Matrix (`interop_matrix/MULTI_VENDOR_INTEROP_REPORT.md`) | `16` vectors × `7` external codebases + triple engine | `100%` Mainnet positive parity (`V01`, `V03`–`V06`) |

## Quick Start

Requirements: Python `>= 3.10`, Rust `>= 1.75` (`cargo`, `clippy`, plus `wasm32-unknown-unknown` target to rebuild WASM), Node `>= 20` (for WASM differential/leak runners), `z3-solver` (for SMT proofs), and `reuse` (optional, for local REUSE 3.3 checks). See [`REPRODUCIBILITY.md`](./REPRODUCIBILITY.md) for single-command artifact reproduction and bit-for-bit WASM build verification.

```bash
# 1. Install the zero-dependency Python package and CLI
pip install .
scitt-time-anchor --mode strict < cases.jsonl

# 2. Run Rust Clippy (-D warnings), unit tests, and release CLI build
cargo clippy --manifest-path scitt_time_anchor_rs/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path scitt_time_anchor_rs/Cargo.toml --release --lib
cargo build --manifest-path scitt_time_anchor_rs/Cargo.toml --release
./scitt_time_anchor_rs/target/release/scitt_time_anchor_rs --mode draft08 < cases.jsonl

# 3. Run conformance, Blind Pack, 64-variant CBOR framing study, Z3 SMT proofs, 50k differential, 100k fuzz & WASM leak sieve
python3 verification_suite/test_appendix_d_conformance.py
python3 verification_suite/verify_blind_pack.py --engine all
python3 verification_suite/experiment_cbor_framing_space_64.py
python3 verification_suite/prove_z3_invariants.py
python3 verification_suite/run_50k_triple_differential.py
python3 verification_suite/test_100k_mutation_fuzz.py
node verification_suite/wasm_100k_leak_runner.mjs

# 4. Verify FSFE REUSE 3.3 SPDX compliance
reuse lint

# 5. Launch the 100% offline browser WASM verifier locally
python3 web/server.py --host 127.0.0.1 --port 8080
```

## CLI Profile Usage (`draft08` vs `strict`)

Both `scitt-time-anchor` (Python) and `scitt_time_anchor_rs` (Rust) read newline-delimited JSON objects on `stdin` (capped at `4 MiB` per line) and write deterministic JSON verdicts on `stdout`:

```bash
# Backward-compatible baseline (11-step draft-fassbender-scitt-time-anchor-08 default)
scitt-time-anchor --mode draft08 < cases.jsonl

# Opt-in hardened profile (Mainnet powLimit + empirical difficulty floor, min_confirmations >= 6, RFC 8259/8949/9052 strictness)
scitt-time-anchor --mode strict < cases.jsonl

# Untrusted JSONL boundary: lock --mode so per-case "mode": "draft08" cannot downgrade strict verification
scitt-time-anchor --mode strict --lock-mode < untrusted_cases.jsonl
```

By default, per-case `"mode": "draft08"` or `"mode": "strict"` inside a JSONL object overrides `--mode` so mixed-profile conformance corpora can be evaluated in one pass. Pass `--lock-mode` whenever ingesting untrusted JSONL so any conflicting per-case `"mode"` fails closed at Step 0 (`invalid`; see [`THREAT_MODEL.md`](./THREAT_MODEL.md)).

## Standards, Reproducibility & Governance Artifacts

| Artifact / Workflow | Standard / Purpose |
| :--- | :--- |
| [`LICENSE`](./LICENSE) & [`LICENSES/Apache-2.0.txt`](./LICENSES/Apache-2.0.txt) | Full canonical SPDX Apache License, Version 2.0. |
| [`REUSE.toml`](./REUSE.toml) & [`.github/workflows/reuse.yml`](./.github/workflows/reuse.yml) | FSFE REUSE 3.3 SPDX copyright and license compliance. |
| [`SECURITY.md`](./SECURITY.md) | RFC 9116 private vulnerability disclosure (GitHub Advisories + OpenPGP), `3.0.x` support policy, EU CRA Art. 14 24h early-warning SLA, and Safe Harbor. |
| [`THREAT_MODEL.md`](./THREAT_MODEL.md) | Trust boundaries, parser/DAG DoS budgets, LEB128/CBOR/JSON parity defenses, consensus downgrade mitigations, and WASM zero-egress isolation. |
| [`CONTRIBUTING.md`](./CONTRIBUTING.md) | IETF RFC 8179 IPR disclosure posture, Apache-2.0 inbound=outbound licensing, and triple-engine parity requirements. |
| [`CODE_OF_CONDUCT.md`](./CODE_OF_CONDUCT.md) | IETF RFC 7154 Guidelines for Conduct & Contributor Covenant v2.1. |
| [`CITATION.cff`](./CITATION.cff) | Machine-readable Citation File Format 1.2.0 metadata. |
| [`codemeta.json`](./codemeta.json) | CodeMeta v3.0 / Schema.org JSON-LD metadata (FAIR4RS, Software Heritage, Zenodo, OpenAIRE, HAL). |
| [`REPRODUCIBILITY.md`](./REPRODUCIBILITY.md) | ACM Artifact Evaluation (*Available*, *Functional*, *Reusable*), JOSS Statement of Need, and `SOURCE_DATE_EPOCH` WASM double-build guide. |
| [`sbom.cdx.json`](./sbom.cdx.json) | OWASP CycloneDX 1.6 zero-dependency SBOM covering Python, Rust, and WASM deliverables with SHA-256 hashes. |
| [`openvex.json`](./openvex.json) | OpenVEX v0.2.0 vulnerability exploitability baseline with zero synthetic CVE entries. |
| [`osps-baseline.json`](./osps-baseline.json) | OpenSSF OSPS Baseline `v2026.08.28` Level 2/3 self-attestation crosswalked to EU CRA (Reg. 2024/2847) and NIST SSDF SP 800-218. |
| [`.github/dependabot.yml`](./.github/dependabot.yml) | Weekly automated GitHub Actions, Cargo, and pip dependency checks. |
| [`.github/workflows/scorecard.yml`](./.github/workflows/scorecard.yml) | OpenSSF Scorecard continuous security assessment uploading SARIF to GitHub Security. |
| [`.github/workflows/ci.yml`](./.github/workflows/ci.yml) | SHA-pinned CI enforcing Clippy `-D warnings`, OpenSSF Gold reproducible WASM double-builds, artifact forensics, anti-obfuscation, cross-manifest version parity, conformance, framing-space, Z3, and 50k differential suites. |
| [`.github/workflows/release.yml`](./.github/workflows/release.yml) | Tag-triggered draft releases with double-build WASM verification, sdist+wheel forensics, SBOM/OpenVEX/OSPS staging, SHA-256 manifests, and SLSA v1 attestations. |
| [`.github/workflows/publish-pypi.yml`](./.github/workflows/publish-pypi.yml) | Isolated OIDC Trusted Publishing workflow with cross-job SHA-256 dist verification, sdist+wheel forensics, and PEP 740 Sigstore attestations. |
| [`.github/workflows/pages.yml`](./.github/workflows/pages.yml) | SHA-pinned offline WASM lab deployment with bit-exact WASM bundle parity, allowlisted `_site/` staging, and static zero-egress verification. |

## Repository Layout

- `pyproject.toml` — PEP 621 package metadata for `scitt-time-anchor` (`3.0.0`, zero runtime dependencies, PEP 561 `py.typed`).
- `scitt_time_anchor_py/` — Pure Python 3 reference verifier (`ots_parser.py`, `bitcoin_chain.py`, `cbor_scitt.py`, `verifier.py`, `cli.py`, `py.typed`).
- `scitt_time_anchor_rs/` — `#![forbid(unsafe_code)]` Rust verifier crate and `wasm_cdylib/` zero-import WebAssembly export shim.
- `draft09_patch/` — Non-normative unified diff (`draft-fassbender-scitt-time-anchor-09-proposed.diff`) and test vectors `N9`–`N16` (`APPENDIX_D6_NEW_NEGATIVE_VECTORS_N9_N16.md`).
- `interop_matrix/` — Multi-vendor interoperability runner and `16 × 8` empirical report (`MULTI_VENDOR_INTEROP_REPORT.md`).
- `spec_vectors/` — Official Appendix D vectors, Bitcoin Mainnet header windows, Z3 witness vectors (`N17A`–`N34`), and 24-vector Blind Salted-Commitment Pack (`blind_vectors_inputs.jsonl`, `blind_vectors_commitments.json`).
- `verification_suite/` — Conformance (`N1`–`N44`), Blind Pack verifier/challenge minter (`verify_blind_pack.py`), 64-variant CBOR framing-space study, Z3 SMT, `50,000`-vector triple-engine differential, `100,000`-mutation fuzz, and single-instance WASM leak verification runners.
- `web/` — Self-contained offline browser WASM lab (`index.html`, `styles.css`, `app.js`, `presets.js`, `wasm_bundle.js`, `scitt_time_anchor.wasm`, `fonts/`, `assets/`, `server.py`).
- `.github/workflows/` — SHA-pinned CI (`ci.yml`), GitHub Pages (`pages.yml`), OpenSSF Scorecard (`scorecard.yml`), FSFE REUSE (`reuse.yml`), SLSA v1 draft release (`release.yml`), and OIDC PyPI (`publish-pypi.yml`) workflows.

## Attribution & License

- **Contributor:** Shady Ismail (`@shady-ismail-titan`, independent open-source contributor; IETF RFC 8179 disclosure posture).
- **License:** Apache License, Version 2.0 ([`LICENSE`](./LICENSE)).
