Skip to main content

kxco-verify (Python)

Receiver-side verifier for the KXCO hybrid HMAC and ML-DSA webhook signature scheme, ML-DSA-87 and ML-DSA-65 (FIPS 204). Wire-format compatible with kxco-post-quantum (npm), the Go verifier, and the Rust verifier.

Install

pip install kxco-verify           # core (HMAC, envelope, fingerprint)
pip install kxco-verify[oqs]      # adds liboqs-python for ML-DSA
pip install kxco-verify[pqcrypto] # adds pqcrypto for ML-DSA

The HMAC, envelope, fingerprint, and timestamp paths use only the Python standard library. ML-DSA verification is lazy-loaded: it only requires a PQC backend when verify_pq is actually called. The pinned public key decides the parameter set: 2592 bytes is ML-DSA-87 and 1952 bytes is ML-DSA-65.

Quick start (FastAPI)

from fastapi import FastAPI, Request, HTTPException
import os
import kxco_verify as kx

PINNED_KID    = "1fd9ed3b769c28fc"  # current KXCO production kid, ML-DSA-87 (refresh from /.well-known if rotated)
PINNED_PUBKEY = bytes.fromhex("...5184 hex chars...")
HMAC_SECRET   = os.environ["KXCO_WEBHOOK_SECRET"].encode()

app = FastAPI()

@app.post("/webhooks/kxco")
async def webhook(request: Request):
    raw_body = await request.body()
    headers = {k.lower(): v for k, v in request.headers.items()}

    result = kx.verify_delivery(
        headers=headers,
        raw_body=raw_body,
        hmac_secret=HMAC_SECRET,
        pq_public_key=PINNED_PUBKEY,
        pinned_kid=PINNED_KID,
    )
    if not result.ok:
        raise HTTPException(401, "invalid signature")

    return {"ok": True}

Running tests

cd python
python test_kxco_verify.py

Expected: All 11 vector tests passed. Without an ML-DSA backend installed, the cryptographic ML-DSA cases are reported as SKIP; set KXCO_REQUIRE_PQ_BACKEND=1 to make a missing backend fail instead.

This verifies that the Python implementation produces identical outputs to vectors.json — the same file used by the JavaScript, Go, and Rust verifiers.

License

MIT.

Metadata

Release files for kxco-verify 1.2.1

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

Source distribution (sdist)

Source distribution for kxco-verify 1.2.1
File Size Uploaded
kxco_verify-1.2.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kxco-verify 1.2.1
File Interpreter ABI Platform
kxco_verify-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / kxco_verify-1.2.1.tar.gz

Download URL kxco_verify-1.2.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fdc27e8160dcf40e66c3a91f437f41ca602b1486080207dde408790fd75b1b51
BLAKE2b-256 checksum
How to use checksums
7cc8a90fbad24b6ab3de33e051ad094b5779d3ac058e677737213f9e612bc8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release files / kxco_verify-1.2.1-py3-none-any.whl

Download URL kxco_verify-1.2.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1600f6de55e3d2fdbad24828214e979b7435cfaf622e7c81d56badc3e8ab46b
BLAKE2b-256 checksum
How to use checksums
e188ad48a8242e7a8bc2b996c1c6f9d2582820649eedd2abfb181c753693b103
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

1.2.2

2 release files

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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