Repository navigation
v0.1.2
v0.1.2
Python and TypeScript bindings for canonprims. Both are thin layers over the
Rust canonprims-json crate, pass the same conformance corpus as the Rust and
Go implementations, and agree with Rust byte for byte. The library, corpus and
canon command are otherwise unchanged from 0.1.1.
What it ships
- Python package
canonprims(PyPI): an abi3 wheel per platform for
CPython 3.10 and later, on linux amd64/arm64 (manylinux2014, glibc 2.17 or
later), darwin arm64 and windows amd64/arm64. No source distribution. - npm package
@3leaps/canonprims: one WebAssembly module with no
imports, embedded in an ES module with no runtime dependencies. Tested on
Node.js 20 and 22. - Rust crates
canonprims-coreandcanonprims-json, the Go module
github.com/3leaps/canonprims(packagecanon) and thecanoncommand
for linux amd64/arm64, darwin arm64 and windows amd64/arm64, as in 0.1.1.
The wheels and the npm package are release assets: built and tested in the
tag workflow, listed in both checksum manifests and covered by both
signatures. The packages on PyPI and npm are these exact files.
The bindings
Both expose the same four verbs as Rust and Go: canonicalize, check, digest
and scheme info. Canonicalize, check and digest take explicit limits on
every call, with the same defaults (16 MiB of input, depth 128, 1,048,576
members per object, 16 MiB per string); a negative limit behaves as 0.
Input outside the I-JSON domain is refused with the same nine normative
codes, plus not_canonical from check, and is never repaired.
- Python: input is any buffer, read as its bytes; a
stris encoded as
UTF-8. Refusals raisecanonprims.Refusal, aValueErrorcarryingcode
andoffset. - TypeScript: input is a
Uint8Arrayor anyArrayBufferView, read as
its bytes; a string is encoded as UTF-8, and a string with an unpaired
surrogate, which has no UTF-8 form, is aTypeError. An input longer than
maxBytesis refused before it is copied into the module. Refusals throw
Refusalwithcodeandoffset.
The WebAssembly crate allows unsafe code only on its exported functions;
SecDR-0001 records
why, the residual risk and the check that enforces it.
Conformance
- Corpus
conformance/canonical-json/v0, 180 cases, unchanged.
MANIFEST.jsonsha256:
de3ac543580ddb90f7e3a6e72239097274d3635ea783f302a9260b5a7d0c8d90. - Rust and Go agree byte for byte on the corpus and on generated input:
crosscheck seeds20261022and20261023, 5000 inputs each, on every
native CI cell. - Each binding runs the whole corpus against its installed package (the
wheel, or the packed npm tarball), and its corpus results and its output on
the same crosscheck seeds equal Rust's byte for byte.
Release machinery
- The release tag restore now confirms origin's tag object even when the
checkout already holds it. - Built bindings carry no build-host path.
Verification
canon canonicalizes and digests; it verifies no signatures, so it embeds no
key. To verify this release, check the signed tag v0.1.2 and the signed
checksum manifests against the public pins committed in the tagged commit
(docs/security/); see docs/security/README.md. A wheel or the npm tarball
downloaded from PyPI or npm has the SHA-256 listed for it in SHA256SUMS.