File: PKG-INFO

package info (click to toggle)
python-rfc8785 0.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: python: 314; makefile: 3
file content (101 lines) | stat: -rw-r--r-- 3,379 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Metadata-Version: 2.1
Name: rfc8785
Version: 0.1.4
Summary: A pure-Python implementation of RFC 8785 (JSON Canonicalization Scheme)
Author-email: Trail of Bits <opensource@trailofbits.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: File Formats :: JSON
Classifier: Topic :: Security :: Cryptography
Requires-Dist: rfc8785[doc,test,lint] ; extra == "dev"
Requires-Dist: build ; extra == "dev"
Requires-Dist: pdoc ; extra == "doc"
Requires-Dist: ruff ~= 0.3 ; extra == "lint"
Requires-Dist: mypy >= 1.0 ; extra == "lint"
Requires-Dist: interrogate ; extra == "lint"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytest-cov ; extra == "test"
Requires-Dist: coverage ; extra == "test"
Project-URL: Documentation, https://trailofbits.github.io/rfc8785.py/
Project-URL: Homepage, https://pypi.org/project/rfc8785
Project-URL: Issues, https://github.com/trailofbits/rfc8785.py/issues
Project-URL: Source, https://github.com/trailofbits/rfc8785.py
Provides-Extra: dev
Provides-Extra: doc
Provides-Extra: lint
Provides-Extra: test

# rfc8785.py

<!--- BADGES: START --->
[![CI](https://github.com/trailofbits/rfc8785.py/actions/workflows/tests.yml/badge.svg)](https://github.com/trailofbits/rfc8785.py/actions/workflows/tests.yml)
[![PyPI version](https://badge.fury.io/py/rfc8785.svg)](https://pypi.org/project/rfc8785)
[![Packaging status](https://repology.org/badge/tiny-repos/python:rfc8785.svg)](https://repology.org/project/python:rfc8785/versions)
<!--- BADGES: END --->

A pure-Python, no-dependency implementation of [RFC 8785], a.k.a. JSON Canonicalization Scheme or JCS.

This implementation should be behaviorally comparable to
[Andrew Rundgren's reference implementation], with the following added constraints:

1. This implementation does not transparently convert non-`str` dictionary keys into
   strings. Users must explicitly perform this conversion.
1. No support for indentation, pretty-printing, etc. is provided. The output is always
   minimally encoded.
2. All APIs produce UTF-8-encoded `bytes` objects or `bytes` I/O.

## Installation

```bash
python -m pip install rfc8785
```

## Usage

See the full API documentation [here].

```python
import rfc8785

foo = {
    "key": "value",
    "another-key": 2,
    "a-third": [1, 2, 3, [4], (5, 6, "this works too")],
    "more": [None, True, False],
}

rfc8785.dumps(foo)
```

yields:

```python
b'{"a-third":[1,2,3,[4],[5,6,"this works too"]],"another-key":2,"key":"value","more":[null,true,false]}'
```

For direct serialization to an I/O sink, use `rfc8785.dump` instead:

```python
import rfc8785

with open("/some/file", mode="wb") as io:
    rfc8785.dump([1, 2, 3, 4], io)
```

All APIs raise `rfc8785.CanonicalizationError` or a subclass on serialization failures.

## Licensing

Apache License, Version 2.0.

Where noted, parts of this implementation are adapted from [Andrew Rundgren's reference implementation], which is also licensed under the Apache License, Version 2.0.

[RFC 8785]: https://datatracker.ietf.org/doc/html/rfc8785

[Andrew Rundgren's reference implementation]: https://github.com/cyberphone/json-canonicalization/tree/master/python3

[here]: https://trailofbits.github.io/rfc8785.py