Metadata-Version: 2.4
Name: canonprims
Version: 0.1.4
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
License-File: LICENSE-MIT
License-File: LICENSE-APACHE
License-File: NOTICE
Summary: Canonical serialization for structured data: RFC 8785 JSON over a strict I-JSON loader
Keywords: canonicalization,rfc8785,jcs,json
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/3leaps/canonprims

# canonprims (Python)

RFC 8785 JSON canonicalization over a strict I-JSON loader: a binding over the
Rust `canonprims-json` crate, gated by the same `canonical-json/v0`
conformance corpus as the Rust and Go implementations.

```python
import canonprims

limits = canonprims.Limits()  # explicit on every call; documented defaults
canonprims.canonicalize(b'{"b":1,"a":2}', limits)  # b'{"a":2,"b":1}'
canonprims.digest(b'{"b":1,"a":2}', limits)        # 'sha256:...'
canonprims.check(b'{"a":2,"b":1}', limits)         # None, or raises Refusal
canonprims.scheme_info()
```

Input is the bytes of any buffer exporter (`bytes`, `bytearray`, `memoryview`,
`array`, `mmap`, ...); a `str` is encoded as UTF-8. Limits follow the spec: a
negative limit behaves as 0. An input with no
canonical form raises `canonprims.Refusal` (a `ValueError`) with a normative
`code` and an informative byte `offset`. Nothing is repaired.

Requires CPython 3.10 or later. See the repository README and
`docs/spec/jcs-rfc8785.md` for the scheme.

