abiz 2026.1116.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ __pycache__/
5
+ *.egg-info/
6
+ .pytest_cache/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,36 @@
1
+ ABIZ reference libraries
2
+ Copyright 2026 To.Co Technologies Limited and the ABIZ contributors.
3
+
4
+ Licensed under the Apache License, Version 2.0 (LICENSE), except as noted below.
5
+
6
+ Third-party material
7
+ --------------------
8
+
9
+ test-vectors/data/iso3166.json, and the copy of it each library bundles
10
+
11
+ Country codes (ISO 3166-1 alpha-2) and selected subdivision codes
12
+ (ISO 3166-2), extracted from the Debian iso-codes data
13
+ (https://salsa.debian.org/iso-codes-team/iso-codes) as redistributed by
14
+ pycountry 26.2.16 (https://pypi.org/project/pycountry/26.2.16/), copied
15
+ unchanged from abiz-org/abiz-agentic-business-record.
16
+
17
+ iso-codes and pycountry are distributed under the GNU Lesser General
18
+ Public License, version 2.1
19
+ (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).
20
+
21
+ This material is not covered by the Apache License 2.0.
22
+
23
+ test-vectors/jcs.json (the first six cases)
24
+
25
+ RFC 8785 test data from cyberphone/json-canonicalization
26
+ (https://github.com/cyberphone/json-canonicalization), Apache License 2.0.
27
+
28
+ abiz (Python)
29
+ -------------
30
+
31
+ Parts of this library are ported from scripts/validate.py in
32
+ abiz-org/abiz-agentic-business-record (https://github.com/abiz-org/abiz-agentic-business-record),
33
+ Apache License 2.0: the RFC 8785 number serialisation, the opening-hours overlap
34
+ rules and other semantic record checks. The bundled
35
+ src/abiz/data/abiz-business-record-v1.1.schema.json is copied unchanged from the
36
+ same repository (Apache License 2.0).
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.5
2
+ Name: abiz
3
+ Version: 2026.1116.1
4
+ Summary: Check ABIZ (Agentic Business Record) DNS assertions and signed business records, ABIZ 1.1.
5
+ Project-URL: Homepage, https://abizrecord.org
6
+ Project-URL: Repository, https://github.com/abiz-org/abiz-python
7
+ Project-URL: Issues, https://github.com/abiz-org/abiz-python/issues
8
+ Author: ABIZ contributors
9
+ Maintainer: ABIZ contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ License-File: src/abiz/data/iso3166.README.md
14
+ Keywords: abiz,agents,business record,dns,ed25519,jcs,rfc8785,txt
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Internet :: Name Service (DNS)
25
+ Classifier: Topic :: Software Development :: Libraries
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: cryptography<51,>=50.0.2
29
+ Requires-Dist: dnspython<3,>=2.8.0; python_version < '3.11'
30
+ Requires-Dist: dnspython<3,>=2.9.1; python_version >= '3.11'
31
+ Requires-Dist: fqdn<2,>=1.6.0
32
+ Requires-Dist: idna<4,>=3.20
33
+ Requires-Dist: jsonschema<5,>=4.26.0
34
+ Requires-Dist: rfc3339-validator<0.2,>=0.1.4
35
+ Requires-Dist: rfc3986-validator<0.2,>=0.1.1
36
+ Requires-Dist: tzdata>=2026.6; sys_platform == 'win32'
37
+ Provides-Extra: test
38
+ Requires-Dist: pytest==9.2.0; extra == 'test'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # abiz (Python)
42
+
43
+ A Python library and command for consumers of ABIZ, the Agentic Business Record. Given a domain, it finds the domain's `_abiz` DNS TXT assertion and fetches the business record the assertion points to. It then checks that record and tells you whether it resolved. It gives the same status and error code as the hosted resolver at `resolve.abizrecord.org`.
44
+
45
+ It implements **ABIZ 1.1** and passes every case in the shared ABIZ test vectors (format 1).
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install abiz
51
+ ```
52
+
53
+ Python 3.10 or later.
54
+
55
+ ## Example
56
+
57
+ ```python
58
+ import abiz
59
+
60
+ result = abiz.resolve("harbourbikes.example.org") # or abiz.resolve(website="https://www.example.com/about")
61
+ if result.ok:
62
+ record = result.record
63
+ print(record["business_name"], record["identity_host"])
64
+ else:
65
+ print(result.status, result.code, result.message) # e.g. not_found missing_txt
66
+ if result.retryable:
67
+ print("Temporary failure: this does not show the record is missing.")
68
+ ```
69
+
70
+ From the command line:
71
+
72
+ ```bash
73
+ abiz check harbourbikes.example.org
74
+ abiz check --website https://www.example.com/about --json
75
+ ```
76
+
77
+ The command exits with 0 when the record resolved. It exits with 1 when the record is invalid, missing or in conflict. It exits with 2 when a lookup was unavailable or the input was not a usable domain.
78
+
79
+ ## What is checked
80
+
81
+ In the order the resolver uses (the first failure decides the code):
82
+
83
+ 1. **Input.** The input is lower-cased, IDN is converted to A-labels and one trailing dot is dropped. A URL, port, credentials or IP literal is refused (`invalid_domain`, `invalid_website`). So is a special-use name (`non_public_domain`). `www.` is never stripped; the apex is only suggested (`try_apex` warning).
84
+ 2. **DNS.** The library sends one TXT query for `_abiz.<domain>`. NXDOMAIN and NODATA count as absence. A timeout or a failure is reported as `unavailable` and never counts as absence.
85
+ 3. **Assertion.** Exactly one `v=abiz1` value is allowed (`multiple_txt`). It is read with the ABIZ 1.1 tag-list syntax. `h` must be a host with an optional path. `k` is the business key, if present. `p` is a canonical base64 Ed25519 key.
86
+ 4. **Well-known file.** `https://<domain>/.well-known/abiz.json` is used only when DNS answered and held no `v=abiz1` value.
87
+ 5. **Fetch.** The library makes one GET of `https://<h>?format=json` through the fetch guard. It checks every resolved address and refuses private, reserved and special-purpose ranges. It then connects to the checked address, never to the name a second time. TLS is verified for the name. Redirects are not followed, the timeout is 5 s and the body limit is 64 KiB.
88
+ 6. **Record.** The record must be I-JSON: repeated member names are refused, nesting may be at most 16 deep and there may be at most 5,000 members. It must pass the pinned ABIZ 1.1 JSON Schema (Draft 2020-12, formats asserted) and the semantic checks. Those checks cover safe https URLs, assigned country and region codes, IANA time zones, non-overlapping opening hours, unique ids and ratings within their scale.
89
+ 7. **Link.** `identity_host` must equal `h`, and `domains` must include the queried domain. `k` and `business_key` must agree with `country` and `registration_number`. `public_key` must equal `p`.
90
+ 8. **Signature.** The signature must be a valid Ed25519 signature over the RFC 8785 (JCS) form of the record, without its `signature` member.
91
+
92
+ ## What is not checked
93
+
94
+ - **No company register is consulted.** A resolved record is the publisher's own statement. The library checks that it is well formed and signed with the key that the domain's DNS publishes. The business facts in it are checked for form only. They are not verified against any register or other source.
95
+ - **`mcp_server_url` and every other URL in a record are never contacted.** At most two requests are made: the well-known file (only when DNS has no assertion) and the record.
96
+ - DNSSEC is not validated. The answer is whatever your configured DNS resolver returns.
97
+ - Time zones are checked against the IANA database installed with Python (`zoneinfo`; the `tzdata` package is installed on Windows).
98
+
99
+ ## API
100
+
101
+ | Function | Returns |
102
+ | --- | --- |
103
+ | `resolve(domain)` / `resolve(website=...)` | A `Result`. Its fields are `status` (`resolved`, `invalid_input`, `not_found`, `conflict`, `invalid_record` or `unavailable`), `code` (None when resolved), `message`, `retryable`, `details` (path and message, at most 25), `record` (only when resolved), `discovery` (`method` `dns_txt` or `well_known`, `owner`, `dns_value`, `record_url`, `well_known`, `well_known_url`) and `warnings` (`content_type`, `try_apex` with `domain`). `Result.to_dict()` gives the same as plain data. |
104
+ | `parse_assertion(value)` | An `Assertion` (`h`, `k`, `p`, `unknown`), or an `AssertionProblem` with `.code` (falsy) |
105
+ | `check_record(record_text, domain, assertion, details=None)` | None, or the error code; works offline (`assertion` is a TXT value or an `Assertion`) |
106
+ | `verify_signature(record, p)` | None (ok), `public_key_mismatch` or `signature_invalid` |
107
+ | `canonicalize(value)` | The RFC 8785 text |
108
+ | `sign_record(record, private_key)` | A producer helper. Returns a copy of the record with `public_key` and `signature` set. The key is a `cryptography` Ed25519 private key or its 32-byte seed. |
109
+ | `is_assertion`, `is_public_key`, `is_public_address`, `identity_parts`, `normalise_input`, `parse_business_key`, `signing_input`, `public_key_of` | The individual rules the functions above use |
110
+
111
+ DNS and HTTP are separate, small interfaces. Pass `dns=` (an object with `query_txt(name) -> TxtLookup`) and `fetcher=` (an object with `fetch(url) -> FetchOutcome`) to `resolve` to use DNS-over-HTTPS, a proxy, a cache or test stubs. The defaults are `DnsPythonResolver` (dnspython, 2.5 s) and `GuardedFetcher` (the standard library, with the fetch guard above). `GuardedFetcher(resolve_addresses=...)` takes your own A/AAAA lookup. If you write your own fetcher, it must apply the same guard.
112
+
113
+ ## Conformance
114
+
115
+ The library passes all of the shared ABIZ test vectors, format 1, for ABIZ 1.1. The vectors cover assertions, public keys, hosts and inputs, addresses, JCS, signing, records checked offline, and whole resolutions against a fake DNS and fetch. It bundles two files and checks each against its SHA-256 at load time:
116
+
117
+ - `abiz-business-record-v1.1.schema.json`, SHA-256 `3658f17f00c238b8c948fdfb447b509c5d055dd778ebd335495da05c3150ff24`
118
+ - `iso3166.json`, SHA-256 `0aa5112c46bc2b3efb254ea9536b3cf2977c73d48149aefcd8bc20df995e5527`
119
+
120
+ To run the tests from a checkout (the vectors are in `test-vectors/`; set `ABIZ_TEST_VECTORS` to use another copy):
121
+
122
+ ```bash
123
+ python -m venv .venv && .venv/bin/pip install --require-hashes -r requirements-lock.txt && .venv/bin/pip install --no-deps -e . && .venv/bin/python -m pytest
124
+ ```
125
+
126
+ ## Licence
127
+
128
+ The library is licensed under Apache-2.0; see `LICENSE` and `NOTICE`. Parts are ported from the ABIZ reference validator (`scripts/validate.py`, Apache-2.0). The bundled `iso3166.json` is LGPL-2.1 (Debian iso-codes via pycountry); see `abiz/data/iso3166.README.md`.
129
+
130
+ Homepage: https://abizrecord.org. Source: https://github.com/abiz-org/abiz-python
@@ -0,0 +1,90 @@
1
+ # abiz (Python)
2
+
3
+ A Python library and command for consumers of ABIZ, the Agentic Business Record. Given a domain, it finds the domain's `_abiz` DNS TXT assertion and fetches the business record the assertion points to. It then checks that record and tells you whether it resolved. It gives the same status and error code as the hosted resolver at `resolve.abizrecord.org`.
4
+
5
+ It implements **ABIZ 1.1** and passes every case in the shared ABIZ test vectors (format 1).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install abiz
11
+ ```
12
+
13
+ Python 3.10 or later.
14
+
15
+ ## Example
16
+
17
+ ```python
18
+ import abiz
19
+
20
+ result = abiz.resolve("harbourbikes.example.org") # or abiz.resolve(website="https://www.example.com/about")
21
+ if result.ok:
22
+ record = result.record
23
+ print(record["business_name"], record["identity_host"])
24
+ else:
25
+ print(result.status, result.code, result.message) # e.g. not_found missing_txt
26
+ if result.retryable:
27
+ print("Temporary failure: this does not show the record is missing.")
28
+ ```
29
+
30
+ From the command line:
31
+
32
+ ```bash
33
+ abiz check harbourbikes.example.org
34
+ abiz check --website https://www.example.com/about --json
35
+ ```
36
+
37
+ The command exits with 0 when the record resolved. It exits with 1 when the record is invalid, missing or in conflict. It exits with 2 when a lookup was unavailable or the input was not a usable domain.
38
+
39
+ ## What is checked
40
+
41
+ In the order the resolver uses (the first failure decides the code):
42
+
43
+ 1. **Input.** The input is lower-cased, IDN is converted to A-labels and one trailing dot is dropped. A URL, port, credentials or IP literal is refused (`invalid_domain`, `invalid_website`). So is a special-use name (`non_public_domain`). `www.` is never stripped; the apex is only suggested (`try_apex` warning).
44
+ 2. **DNS.** The library sends one TXT query for `_abiz.<domain>`. NXDOMAIN and NODATA count as absence. A timeout or a failure is reported as `unavailable` and never counts as absence.
45
+ 3. **Assertion.** Exactly one `v=abiz1` value is allowed (`multiple_txt`). It is read with the ABIZ 1.1 tag-list syntax. `h` must be a host with an optional path. `k` is the business key, if present. `p` is a canonical base64 Ed25519 key.
46
+ 4. **Well-known file.** `https://<domain>/.well-known/abiz.json` is used only when DNS answered and held no `v=abiz1` value.
47
+ 5. **Fetch.** The library makes one GET of `https://<h>?format=json` through the fetch guard. It checks every resolved address and refuses private, reserved and special-purpose ranges. It then connects to the checked address, never to the name a second time. TLS is verified for the name. Redirects are not followed, the timeout is 5 s and the body limit is 64 KiB.
48
+ 6. **Record.** The record must be I-JSON: repeated member names are refused, nesting may be at most 16 deep and there may be at most 5,000 members. It must pass the pinned ABIZ 1.1 JSON Schema (Draft 2020-12, formats asserted) and the semantic checks. Those checks cover safe https URLs, assigned country and region codes, IANA time zones, non-overlapping opening hours, unique ids and ratings within their scale.
49
+ 7. **Link.** `identity_host` must equal `h`, and `domains` must include the queried domain. `k` and `business_key` must agree with `country` and `registration_number`. `public_key` must equal `p`.
50
+ 8. **Signature.** The signature must be a valid Ed25519 signature over the RFC 8785 (JCS) form of the record, without its `signature` member.
51
+
52
+ ## What is not checked
53
+
54
+ - **No company register is consulted.** A resolved record is the publisher's own statement. The library checks that it is well formed and signed with the key that the domain's DNS publishes. The business facts in it are checked for form only. They are not verified against any register or other source.
55
+ - **`mcp_server_url` and every other URL in a record are never contacted.** At most two requests are made: the well-known file (only when DNS has no assertion) and the record.
56
+ - DNSSEC is not validated. The answer is whatever your configured DNS resolver returns.
57
+ - Time zones are checked against the IANA database installed with Python (`zoneinfo`; the `tzdata` package is installed on Windows).
58
+
59
+ ## API
60
+
61
+ | Function | Returns |
62
+ | --- | --- |
63
+ | `resolve(domain)` / `resolve(website=...)` | A `Result`. Its fields are `status` (`resolved`, `invalid_input`, `not_found`, `conflict`, `invalid_record` or `unavailable`), `code` (None when resolved), `message`, `retryable`, `details` (path and message, at most 25), `record` (only when resolved), `discovery` (`method` `dns_txt` or `well_known`, `owner`, `dns_value`, `record_url`, `well_known`, `well_known_url`) and `warnings` (`content_type`, `try_apex` with `domain`). `Result.to_dict()` gives the same as plain data. |
64
+ | `parse_assertion(value)` | An `Assertion` (`h`, `k`, `p`, `unknown`), or an `AssertionProblem` with `.code` (falsy) |
65
+ | `check_record(record_text, domain, assertion, details=None)` | None, or the error code; works offline (`assertion` is a TXT value or an `Assertion`) |
66
+ | `verify_signature(record, p)` | None (ok), `public_key_mismatch` or `signature_invalid` |
67
+ | `canonicalize(value)` | The RFC 8785 text |
68
+ | `sign_record(record, private_key)` | A producer helper. Returns a copy of the record with `public_key` and `signature` set. The key is a `cryptography` Ed25519 private key or its 32-byte seed. |
69
+ | `is_assertion`, `is_public_key`, `is_public_address`, `identity_parts`, `normalise_input`, `parse_business_key`, `signing_input`, `public_key_of` | The individual rules the functions above use |
70
+
71
+ DNS and HTTP are separate, small interfaces. Pass `dns=` (an object with `query_txt(name) -> TxtLookup`) and `fetcher=` (an object with `fetch(url) -> FetchOutcome`) to `resolve` to use DNS-over-HTTPS, a proxy, a cache or test stubs. The defaults are `DnsPythonResolver` (dnspython, 2.5 s) and `GuardedFetcher` (the standard library, with the fetch guard above). `GuardedFetcher(resolve_addresses=...)` takes your own A/AAAA lookup. If you write your own fetcher, it must apply the same guard.
72
+
73
+ ## Conformance
74
+
75
+ The library passes all of the shared ABIZ test vectors, format 1, for ABIZ 1.1. The vectors cover assertions, public keys, hosts and inputs, addresses, JCS, signing, records checked offline, and whole resolutions against a fake DNS and fetch. It bundles two files and checks each against its SHA-256 at load time:
76
+
77
+ - `abiz-business-record-v1.1.schema.json`, SHA-256 `3658f17f00c238b8c948fdfb447b509c5d055dd778ebd335495da05c3150ff24`
78
+ - `iso3166.json`, SHA-256 `0aa5112c46bc2b3efb254ea9536b3cf2977c73d48149aefcd8bc20df995e5527`
79
+
80
+ To run the tests from a checkout (the vectors are in `test-vectors/`; set `ABIZ_TEST_VECTORS` to use another copy):
81
+
82
+ ```bash
83
+ python -m venv .venv && .venv/bin/pip install --require-hashes -r requirements-lock.txt && .venv/bin/pip install --no-deps -e . && .venv/bin/python -m pytest
84
+ ```
85
+
86
+ ## Licence
87
+
88
+ The library is licensed under Apache-2.0; see `LICENSE` and `NOTICE`. Parts are ported from the ABIZ reference validator (`scripts/validate.py`, Apache-2.0). The bundled `iso3166.json` is LGPL-2.1 (Debian iso-codes via pycountry); see `abiz/data/iso3166.README.md`.
89
+
90
+ Homepage: https://abizrecord.org. Source: https://github.com/abiz-org/abiz-python
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["hatchling==1.33.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "abiz"
7
+ version = "2026.1116.1"
8
+ description = "Check ABIZ (Agentic Business Record) DNS assertions and signed business records, ABIZ 1.1."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE", "NOTICE", "src/abiz/data/iso3166.README.md"]
13
+ authors = [{ name = "ABIZ contributors" }]
14
+ maintainers = [{ name = "ABIZ contributors" }]
15
+ keywords = ["abiz", "business record", "dns", "txt", "ed25519", "jcs", "rfc8785", "agents"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Topic :: Internet :: Name Service (DNS)",
27
+ "Topic :: Software Development :: Libraries",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "cryptography>=50.0.2,<51",
32
+ "dnspython>=2.8.0,<3; python_version < \"3.11\"",
33
+ "dnspython>=2.9.1,<3; python_version >= \"3.11\"",
34
+ "fqdn>=1.6.0,<2",
35
+ "idna>=3.20,<4",
36
+ "jsonschema>=4.26.0,<5",
37
+ "rfc3339-validator>=0.1.4,<0.2",
38
+ "rfc3986-validator>=0.1.1,<0.2",
39
+ "tzdata>=2026.6; sys_platform == \"win32\"",
40
+ ]
41
+
42
+ [project.optional-dependencies]
43
+ test = ["pytest==9.2.0"]
44
+
45
+ [project.scripts]
46
+ abiz = "abiz.cli:main"
47
+
48
+ [project.urls]
49
+ Homepage = "https://abizrecord.org"
50
+ Repository = "https://github.com/abiz-org/abiz-python"
51
+ Issues = "https://github.com/abiz-org/abiz-python/issues"
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/abiz"]
55
+
56
+ [tool.hatch.build.targets.sdist]
57
+ include = [
58
+ "src/abiz",
59
+ "tests",
60
+ "README.md",
61
+ "LICENSE",
62
+ "NOTICE",
63
+ "pyproject.toml",
64
+ ]
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+ addopts = "-ra"
@@ -0,0 +1,67 @@
1
+ """ABIZ (Agentic Business Record) consumer library, ABIZ 1.1.
2
+
3
+ Find a domain's ``_abiz`` DNS assertion, fetch the business record it points to, and check it:
4
+ the JSON Schema, the semantic rules, the link between DNS and the record, and the Ed25519
5
+ signature by the key DNS publishes. A resolved record is the publisher's own statement; this
6
+ library never checks a company register and never calls ``mcp_server_url``.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from ._version import __version__
12
+ from ._data import ABIZ_REVISION, ISO3166_SHA256, SCHEMA_ID, SCHEMA_SHA256
13
+ from .addresses import is_public_address
14
+ from .assertion import Assertion, AssertionProblem, is_assertion, is_public_key, parse_assertion
15
+ from .business_key import BusinessKey, BusinessKeyError, parse_business_key
16
+ from .hosts import identity_parts, normalise_input
17
+ from .jcs import JcsError, canonicalize
18
+ from .resolve import Discovery, Result, check_record, resolve
19
+ from .signature import public_key_of, sign_record, signing_input, verify_signature
20
+ from .transport import (
21
+ USER_AGENT,
22
+ AddressLookupError,
23
+ DnsPythonResolver,
24
+ FetchOutcome,
25
+ Fetcher,
26
+ GuardedFetcher,
27
+ TxtLookup,
28
+ TxtResolver,
29
+ )
30
+
31
+
32
+ __all__ = [
33
+ "ABIZ_REVISION",
34
+ "AddressLookupError",
35
+ "Assertion",
36
+ "AssertionProblem",
37
+ "BusinessKey",
38
+ "BusinessKeyError",
39
+ "Discovery",
40
+ "DnsPythonResolver",
41
+ "FetchOutcome",
42
+ "Fetcher",
43
+ "GuardedFetcher",
44
+ "ISO3166_SHA256",
45
+ "JcsError",
46
+ "Result",
47
+ "SCHEMA_ID",
48
+ "SCHEMA_SHA256",
49
+ "TxtLookup",
50
+ "TxtResolver",
51
+ "USER_AGENT",
52
+ "__version__",
53
+ "canonicalize",
54
+ "check_record",
55
+ "identity_parts",
56
+ "is_assertion",
57
+ "is_public_address",
58
+ "is_public_key",
59
+ "normalise_input",
60
+ "parse_assertion",
61
+ "parse_business_key",
62
+ "public_key_of",
63
+ "resolve",
64
+ "sign_record",
65
+ "signing_input",
66
+ "verify_signature",
67
+ ]
@@ -0,0 +1,53 @@
1
+ """The bundled files: the ABIZ 1.1 business record schema and the ISO 3166 code list, pinned by SHA-256."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import json
7
+ from functools import lru_cache
8
+ from importlib import resources
9
+ from typing import Any
10
+
11
+ #: The ABIZ revision this library implements.
12
+ ABIZ_REVISION = "1.1"
13
+ SCHEMA_ID = "https://abizrecord.org/schema/abiz-business-record-v1.1.schema.json"
14
+ SCHEMA_FILE = "abiz-business-record-v1.1.schema.json"
15
+ ISO3166_FILE = "iso3166.json"
16
+ #: SHA-256 of the bundled files, as test-vectors/README.md lists them.
17
+ SCHEMA_SHA256 = "3658f17f00c238b8c948fdfb447b509c5d055dd778ebd335495da05c3150ff24"
18
+ ISO3166_SHA256 = "0aa5112c46bc2b3efb254ea9536b3cf2977c73d48149aefcd8bc20df995e5527"
19
+
20
+
21
+ def data_bytes(name: str) -> bytes:
22
+ """The bytes of a bundled file."""
23
+ return resources.files("abiz").joinpath("data", name).read_bytes()
24
+
25
+
26
+ def _checked(name: str, sha256: str) -> Any:
27
+ raw = data_bytes(name)
28
+ digest = hashlib.sha256(raw).hexdigest()
29
+ if digest != sha256:
30
+ raise RuntimeError(f"bundled {name} has SHA-256 {digest}, expected {sha256}")
31
+ return json.loads(raw.decode("utf-8"))
32
+
33
+
34
+ @lru_cache(maxsize=1)
35
+ def schema() -> dict[str, Any]:
36
+ """The pinned ABIZ 1.1 business record schema (JSON Schema Draft 2020-12)."""
37
+ return _checked(SCHEMA_FILE, SCHEMA_SHA256)
38
+
39
+
40
+ @lru_cache(maxsize=1)
41
+ def iso3166() -> dict[str, Any]:
42
+ """The pinned ISO 3166 code list (LGPL-2.1, see data/iso3166.README.md)."""
43
+ return _checked(ISO3166_FILE, ISO3166_SHA256)
44
+
45
+
46
+ @lru_cache(maxsize=1)
47
+ def countries() -> frozenset[str]:
48
+ return frozenset(iso3166()["countries"])
49
+
50
+
51
+ @lru_cache(maxsize=1)
52
+ def subdivisions() -> dict[str, frozenset[str]]:
53
+ return {country: frozenset(codes) for country, codes in iso3166()["subdivisions"].items()}