Skip to main content

ocx-integrity

Canonical, salted per-aspect hashes and a Merkle manifest root for OCX models (profile ocx-hash/1). The full specification is docs/superpowers/specs/2026-11-08-ocx-integrity-manifest-design.md.

  • Every part (plate, stiffener, bracket, pillar, edge reinforcement, panel, seam, compartment, plus one vessel-metadata part) gets a stable part ID: its GUID, or its XML id if it has no GUID.
  • Each part is split into up to five aspects: identity, material, scantlings, geometry, physical. Each aspect is a canonical JSON record: SI decimal strings (fixed high-precision decimal context), resolved references (panel SurfaceRefs into SurfaceCollections are inlined; EdgeCurveRef limits commit only the GUID), sorted sets, normalised closed contours (exact decimal Newell normals), serialised with RFC 8785 (JCS).
  • aspect_hash = SHA-256(salt ‖ JCS(payload)), where salt = HMAC-SHA256(K, "ocx-hash/1" ‖ 0 ‖ part_id ‖ 0 ‖ aspect). Without the key, hashes cannot be brute-forced against guessed scantlings.
  • Part hashes are RFC 9162 Merkle roots of their aspect hashes. The manifest root is the Merkle root of all part hashes in UTF-8 byte order of the part IDs.
  • The manifest contains only part IDs and salted hashes, so it is safe to share. The key K (≥ 32 bytes, hex) never leaves the yard.

CLI

ocx-integrity keygen   -o yard.key                               # once; keep it secret
ocx-integrity manifest model.3docx --key yard.key -o manifest.json
ocx-integrity verify   model.3docx manifest.json --key yard.key  # exit 1 if anything changed
ocx-integrity prove    model.3docx manifest.json --key yard.key --part ID [--aspect A]... -o bundle.json
ocx-integrity check    bundle.json [--root HEX]                  # no key needed
ocx-integrity diff     old.json new.json [--format text|json]

The key can also be given via OCX_INTEGRITY_KEY (hex); --key FILE wins. keygen creates the key file exclusively with owner-only permissions (0600 on POSIX) and never overwrites an existing file. prove discloses all aspects unless --aspect is given. Exit codes:

  • 0: ok, match, or bundle valid.
  • 1: changes found, bundle invalid, or part drift on prove.
  • 2: cannot run (parse/build failure, bad key, existing key file on keygen, unsupported profile, malformed manifest or bundle (incl. duplicate JSON keys), tampered manifest (hashes that do not recompute), duplicate part IDs, unknown part/aspect). A bundle whose hashes do not check out is invalid (exit 1).
  • 3: cannot write output.

Diffing manifests built with different keys reports every part as changed.

Canonical records can gain fields within ocx-hash/1 (see CHANGELOG.md). A model that sets a newly hashed field will then fail verify against a manifest built by an older version. Rebuild such manifests.

Security notes

  • Manifests are validated strictly on load: malformed JSON, duplicate keys or part/root hashes that do not recompute raise IntegrityError; a different profile raises ProfileMismatchError.
  • A bundle's tree_size is not independently authenticated by the root. Pass --root from a trusted (signed) manifest, and if the part count matters, pin it from that authenticated manifest too.

Python API

from ocx_integrity import build_manifest, verify_model, prove, check_bundle, diff_manifests

Metadata

Release files for ocx-integrity 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocx-integrity 0.3.0
File Size Uploaded Provenance Actions
ocx_integrity-0.3.0.tar.gz 21.8 kB With provenance Details for ocx_integrity-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocx-integrity 0.3.0
File Interpreter ABI Platform Actions
ocx_integrity-0.3.0-py3-none-any.whl Python 3 none any Details for ocx_integrity-0.3.0-py3-none-any.whl

Total release size: 53.8 kB

Release files / ocx_integrity-0.3.0.tar.gz

Download URL ocx_integrity-0.3.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
952b9c2443320f8f6fc08260ef4d40e33f29eba30e78cc9b4eef7ba8e98480a5
BLAKE2b-256 checksum
How to use checksums
f145a6000500c5aa109021a8d9b5a50c1a0eaf746803418993e4bac5ac98a765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / ocx_integrity-0.3.0-py3-none-any.whl

Download URL ocx_integrity-0.3.0-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae290d2f950dceb496503589261027ec7bf20306274158e14020a0cd11c9f0d0
BLAKE2b-256 checksum
How to use checksums
4e33a5234e1d3a689be746b296c420c7ba8c5227e5c49a47becdb21b0277405e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for ocx-integrity 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ocx_integrity-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page