Skip to main content

sm-conformance

Mechanical, cryptographically-attestable protocol conformance — signed badges any party re-verifies offline.

A protocol is only "open" if compliance is checkable. sm-conformance is the toolkit for that check: a runtime runs a vectors-driven suite, then ships a small JSON badge signed by its own Ed25519 key recording which suite it passed (pinned by a suite_digest) and the pass/fail counts. Anyone holding the runtime's did:key can re-verify the badge offline — no service, no vendor, no trust-me. This package owns exactly that envelope: building it, signing it, pinning it, and verifying it. It does not define your protocol's tests — you bring those.

What this package secures (v0.1)

  • Offline-verifiable attestation. A badge is an Ed25519 signature over an RFC 8785 (JCS) canonical JSON payload, with the signed value space constrained to ASCII strings, integers, booleans, and null so two implementations cannot diverge; verification needs only the embedded did:key and cryptography — no network, no proprietary service.
  • Load-bearing structure. verify_envelope validates the payload against the JSON Schema on the verify path — a malformed-but-signed badge is rejected, not merely flagged in a test.
  • Corpus pinning. suite_digest is a SHA-256 over the vector corpus, so a badge proves which suite ran; swapping in a weaker corpus changes the digest.
  • Honest gating — in the library, not just the CLI. verify_badge refuses a badge that records failed, errored or xfailed > 0 or a non-zero exit_status unless you explicitly opt into signature-only mode (allow_failures=True), and rejects a badge whose completed_at, signed_at or countersigned_at is more than a small skew (default 300 s) in the future — a forward-dated badge would otherwise satisfy any age bound forever. The CLI is a thin front-end to the same function, so the two cannot disagree.
  • Adversarially tested. Tampered payloads, tampered signatures, wrong signer, non-did:key signer, missing fields, pass-gate evasion, forward-dated timestamps and out-of-range integers are all covered by golden vectors and unit tests (142 tests).

What this package does NOT do

  • Run your tests. It attests the result of a suite; wiring a suite (and the adapter that plugs a runtime in) is the consumer's responsibility — see the reference example.
  • Prove a self-signed run happened. A rung-1 badge is a claim by the key holder; its total_vectors is self-attested and catches only an honest partial run. Closing under-execution against an adversarial signer is what --expected-total-vectors (a count the verifier knows independently) and rung-2 lab counter-signing are for — both shipped, see SPEC.md §9, §11.

Features

  • verify_badge(envelope, …) -> BadgeVerdict — the admission gate: signature + schema + every SPEC §9 gate (pass gate, corpus pin, vector accounting, skip policy, build/code-digest pins, freshness incl. the future-skew guard, rung-2 method/signer policy). BadgeVerdict.gates names the checks that actually ran.
  • sign_envelope / verify_envelope — build and check a signed badge. verify_envelope is the signature+schema primitive; it is not a pass gate.
  • build_badge(runtime, …) — turnkey generator: assemble + sign a badge from a test run's counts, the skipped-vector IDs, and run provenance. exit_status is derived from failed, errored and xfailed, matching the verifier's gate.
  • compute_suite_digest(path) — pin a badge to a vector corpus (cross-platform stable).
  • derive_did_key / parse_did_key — W3C did:key (base58btc, multicodec 0xed01).
  • run_extensions(surface, target, build=…) — namespaced run provenance incl. build.
  • sm-verify-badge CLI with admission gates: --expected-suite-digest, --expected-total-vectors, --max-skipped / --forbid-skip / --require-skip-ids, --expected-build, --max-age-days, --max-future-skew-s, --require-countersigned (see SPEC §9.1). Also python -m sm_conformance.
  • JSON Schemas for the envelope + counter-signed envelope (sm_conformance/schema/), enforced on the verify path.

Where the badge lives

On disk a runtime ships its badge at .nanda/conformance.json. A runtime that serves it over HTTP should do so at the canonical URL /.well-known/conformance.json — unauthenticated (it's verifiable offline by anyone against the embedded did:key) — and advertise that URL from its discovery doc (a conformance field in /.well-known/nanda-agent.json). See SPEC.md §3.2.

Installation

pip install sm-conformance
# working draft: pip install git+https://github.com/Sharathvc23/sm-conformance.git

Quick start

from sm_conformance import build_badge, compute_suite_digest, verify_badge

seed = bytes(range(32))                      # your runtime's Ed25519 seed (32 bytes)
badge = build_badge(
    "my-runtime",
    signing_key32=seed,
    suite_digest=compute_suite_digest("vectors"),  # SHA-256 over your corpus
    protocol_versions=["0.1"],
    completed_at="2026-05-31T00:00:00+00:00",
    passed=42, failed=0, skipped=0,          # exit_status is derived for you
)

# The admission gate: signature + schema + pass gate + freshness/skew guard, and
# any pin you assert. Raises VerificationError if any gate refuses the badge.
verdict = verify_badge(badge, expected_suite_digest=badge["payload"]["suite_digest"])
print(verdict.gates)      # ('signature', 'suite_digest', 'future_skew', 'pass')

# Low-level primitive — proves signature + shape ONLY; a failing run verifies here.
from sm_conformance import verify_envelope
verify_envelope(badge)
sm-verify-badge badge.json --expected-suite-digest sha256:<hex>

Reference fixtures

tests/fixtures/ holds the golden badge vectors — one positive (valid-signed-badge) and six negative (tampered-payload, tampered-signature, wrong-signer, non-didkey-signer, missing-signature, failing-run), each self-declaring its expected verification outcome. They are deterministic (regenerate with python -m sm_conformance._badge_vector_gen). The keys are fixed test seeds, not production signers.

Specification

  • SPEC.md — normative envelope, canonical encoding, signing, suite-digest, verification algorithm, and trust ladder. Working draft.
  • THREATMODEL.md — what a badge does and does not prove, threats T1–T10, the trust-rung roadmap, and a relying-party checklist.
  • WHITEPAPER.md — why mechanical conformance matters for an internet of independently-built agents.
Package Role
sm-attest-viewer Renderer for attested agent action-envelope chains
sm-decision-inspector Human-in-the-loop decision workbench
sm-locp Open compliance protocol (defeasible logic + W3C VCs)

License

MIT


First published: 2026-05-31 | Last modified: 2026-11-11

Personal research contributions aligned with Project NANDA standards. Stellarminds.ai

Metadata

Release files for sm-conformance 0.4.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 sm-conformance 0.4.0
File Size Uploaded Provenance Actions
sm_conformance-0.4.0.tar.gz 61.0 kB With provenance Details for sm_conformance-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sm-conformance 0.4.0
File Interpreter ABI Platform Actions
sm_conformance-0.4.0-py3-none-any.whl Python 3 none any Details for sm_conformance-0.4.0-py3-none-any.whl

Total release size: 91.9 kB

Release files / sm_conformance-0.4.0.tar.gz

Download URL sm_conformance-0.4.0.tar.gz
Size 61.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b189207dd0aa0f20e49770d7b331083db33cd3335dca4c1818ca20a008d77fc1
BLAKE2b-256 checksum
How to use checksums
1a5a562a3cb5da6aed7a4dbf2fadb2f77d93ba263c553ee6afb8dd1856c3bf48
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 17, 2026.

Transparency log

Release files / sm_conformance-0.4.0-py3-none-any.whl

Download URL sm_conformance-0.4.0-py3-none-any.whl
Size 30.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b2da152f448919977ddf39b6ae825308b577ddfd41c2e08aef5db6703adb078
BLAKE2b-256 checksum
How to use checksums
18dcf9b29ec7c2565d63c2a208b13d55dbfe0134fefc22324008bc594bcfc2f9
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 17, 2026.

Transparency log

Security for sm-conformance 0.4.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 sm_conformance-0.4.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 17, 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.

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