ffn-verify 0.1.0__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.
Files changed (43) hide show
  1. ffn_verify-0.1.0/LICENSE +202 -0
  2. ffn_verify-0.1.0/MANIFEST.in +4 -0
  3. ffn_verify-0.1.0/NOTICE +5 -0
  4. ffn_verify-0.1.0/PKG-INFO +138 -0
  5. ffn_verify-0.1.0/README.md +111 -0
  6. ffn_verify-0.1.0/ffn_verify/__init__.py +45 -0
  7. ffn_verify-0.1.0/ffn_verify/_egress.py +167 -0
  8. ffn_verify-0.1.0/ffn_verify/_js.py +135 -0
  9. ffn_verify-0.1.0/ffn_verify/_version.py +1 -0
  10. ffn_verify-0.1.0/ffn_verify/binding.py +68 -0
  11. ffn_verify-0.1.0/ffn_verify/business.py +60 -0
  12. ffn_verify-0.1.0/ffn_verify/credential.py +100 -0
  13. ffn_verify-0.1.0/ffn_verify/delegation.py +152 -0
  14. ffn_verify-0.1.0/ffn_verify/did.py +297 -0
  15. ffn_verify-0.1.0/ffn_verify/dns.py +73 -0
  16. ffn_verify-0.1.0/ffn_verify/domain.py +70 -0
  17. ffn_verify-0.1.0/ffn_verify/fetch.py +296 -0
  18. ffn_verify-0.1.0/ffn_verify/jose.py +153 -0
  19. ffn_verify-0.1.0/ffn_verify/networks.py +48 -0
  20. ffn_verify-0.1.0/ffn_verify/pin.py +94 -0
  21. ffn_verify-0.1.0/ffn_verify/presentation.py +115 -0
  22. ffn_verify-0.1.0/ffn_verify/py.typed +0 -0
  23. ffn_verify-0.1.0/ffn_verify/sdjwt.py +272 -0
  24. ffn_verify-0.1.0/ffn_verify/status.py +173 -0
  25. ffn_verify-0.1.0/ffn_verify/url.py +337 -0
  26. ffn_verify-0.1.0/ffn_verify/verify.py +631 -0
  27. ffn_verify-0.1.0/ffn_verify.egg-info/PKG-INFO +138 -0
  28. ffn_verify-0.1.0/ffn_verify.egg-info/SOURCES.txt +41 -0
  29. ffn_verify-0.1.0/ffn_verify.egg-info/dependency_links.txt +1 -0
  30. ffn_verify-0.1.0/ffn_verify.egg-info/requires.txt +1 -0
  31. ffn_verify-0.1.0/ffn_verify.egg-info/top_level.txt +1 -0
  32. ffn_verify-0.1.0/pyproject.toml +56 -0
  33. ffn_verify-0.1.0/setup.cfg +4 -0
  34. ffn_verify-0.1.0/tests/fixtures.py +230 -0
  35. ffn_verify-0.1.0/tests/test_business_rules.py +189 -0
  36. ffn_verify-0.1.0/tests/test_domain.py +57 -0
  37. ffn_verify-0.1.0/tests/test_egress.py +122 -0
  38. ffn_verify-0.1.0/tests/test_fetch.py +277 -0
  39. ffn_verify-0.1.0/tests/test_known_pins.py +144 -0
  40. ffn_verify-0.1.0/tests/test_pins_scope.py +111 -0
  41. ffn_verify-0.1.0/tests/test_status.py +137 -0
  42. ffn_verify-0.1.0/tests/test_trust_first.py +117 -0
  43. ffn_verify-0.1.0/tests/test_vectors.py +183 -0
@@ -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,4 @@
1
+ # The sdist carries the tests (they skip what needs the repository's shared
2
+ # vectors; set FFN_VECTORS to run those) but no build or cache debris.
3
+ graft tests
4
+ global-exclude __pycache__ *.py[cod]
@@ -0,0 +1,5 @@
1
+ FFN Verify
2
+ Copyright 2026 Sweet Papa Technologies LLC
3
+
4
+ This product includes software developed at Sweet Papa Technologies LLC
5
+ (https://sweetpapatechnologies.com) for the FoFo Network (https://fofo.network).
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: ffn-verify
3
+ Version: 0.1.0
4
+ Summary: FFN Verified Business public verifier: registry record, both signatures, status, domain binding and delegation, no wallet needed
5
+ Author: Sweet Papa Technologies LLC
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://registry.fofo.network/agents
8
+ Project-URL: Documentation, https://registry.fofo.network/agents
9
+ Project-URL: Source, https://github.com/Sweet-Papa-Technologies/ffn-verify
10
+ Project-URL: Issues, https://github.com/Sweet-Papa-Technologies/ffn-verify/issues
11
+ Project-URL: API, https://registry.fofo.network/openapi.json
12
+ Keywords: ffn,fofo network,business verification,verifiable credentials,sd-jwt,did:web,token status list,delegation,ai agents
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Typing :: Typed
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Requires-Dist: cryptography<51,>=44.0.1
26
+ Dynamic: license-file
27
+
28
+ <p align="center">
29
+ <a href="https://registry.fofo.network">
30
+ <img src="https://raw.githubusercontent.com/Sweet-Papa-Technologies/ffn-verify/main/assets/ffn-verify-banner.jpg" alt="FFN Verified Business: check a business before your agent trusts it." width="100%">
31
+ </a>
32
+ </p>
33
+ <p align="center">
34
+ <a href="https://github.com/Sweet-Papa-Technologies/ffn-verify/actions/workflows/ci.yml"><img src="https://github.com/Sweet-Papa-Technologies/ffn-verify/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
35
+ <a href="https://pypi.org/project/ffn-verify/"><img src="https://img.shields.io/pypi/v/ffn-verify?label=PyPI" alt="PyPI"></a>
36
+ <a href="https://pypi.org/project/ffn-verify/"><img src="https://img.shields.io/pypi/pyversions/ffn-verify" alt="Python versions"></a>
37
+ <a href="https://github.com/Sweet-Papa-Technologies/ffn-verify/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License: Apache-2.0"></a>
38
+ </p>
39
+
40
+ # ffn-verify
41
+
42
+ Verify a business against [FFN Verified Business](https://registry.fofo.network) before your agent or app trusts it. Give it a domain or a phone number; it fetches the business's signed record and checks all of it in your own process: the registry's signature against pinned keys, the business's own signature, the business's domain pointing back to the registry, and the current status of every fact.
43
+
44
+ TypeScript: [`@fofonet/verify-business`](https://www.npmjs.com/package/@fofonet/verify-business). Both pass the same [test vectors](https://github.com/Sweet-Papa-Technologies/ffn-verify/tree/main/vectors).
45
+
46
+ ```sh
47
+ pip install ffn-verify
48
+ ```
49
+
50
+ Python 3.11 or later. Its only dependency is `cryptography`.
51
+
52
+ ## Verify a business
53
+
54
+ ```python
55
+ from ffn_verify import FFN_BUSINESS_REGISTRY, verify_business
56
+
57
+ r = verify_business(
58
+ "sweetpapatechnologies.com",
59
+ registry=FFN_BUSINESS_REGISTRY,
60
+ observed={"name": "Sweet Papa Technologies", "phone": "+1 510-497-0742"},
61
+ )
62
+
63
+ if r["verified"] and r["observedMatches"]:
64
+ print(r["level"], r["levelName"]) # 1 Registered
65
+ print(r["summary"])
66
+ elif r["verified"]:
67
+ print("Listed, but what you were told differs:", r["mismatches"])
68
+ else:
69
+ print(r["failure"]["code"], r["failure"]["message"])
70
+ ```
71
+
72
+ By phone: `verify_business(phone="+15104970742", registry=FFN_BUSINESS_REGISTRY)`. Pass exactly one of `domain` or `phone`. A phone query only counts the business's official channels when the registry confirmed that number.
73
+
74
+ Results are plain dicts with the same keys as the TypeScript package and the HTTP API (`verified`, `observedMatches`, `level`, `levelName`, `business`, `facts`, `binding`, `scope`, `mismatches`, `warnings`, `failure`, `summary`, `checkedAt`). Their meanings, and every `failure.code`, are in the [repository README](https://github.com/Sweet-Papa-Technologies/ffn-verify#what-a-result-means).
75
+
76
+ - **`verified`**: the record, its signatures and the domain binding check out, and the facts for at least Level 1 are current. It's not a rating or a recommendation.
77
+ - **`observedMatches`**: `False` when anything in `observed` differs from the record. Always check it when you pass `observed`: a hacked site can swap in its own phone while the record stays verified.
78
+ - A verified phone means the business controls that number when _you_ call it. It never means an incoming call or text from that number is from the business.
79
+
80
+ ### Options
81
+
82
+ | Keyword | Default | Meaning |
83
+ | ------------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
84
+ | `registry` | required | The registry to trust. `FFN_BUSINESS_REGISTRY` is the production one, with its keys pinned. |
85
+ | `observed` | `None` | What your agent was told: `{"name", "phone", "address"}`, any of them. |
86
+ | `timeout` | `10.0` | Seconds allowed for each request, body included. |
87
+ | `fetch` | built in (urllib) | Your own fetch, for example through an egress proxy. Size limits and deadlines still apply. |
88
+ | `dns` | Cloudflare DNS over HTTPS | A TXT resolver, e.g. `doh_resolver("google")`. |
89
+ | `resolver`, `store` | built in | A DID resolver and a status-list cache, to share between calls. |
90
+
91
+ `lookup_business(registry=..., domain=...)` (or `phone=`) returns the record without the full check. Only the registry's signature is verified, so use `verify_business` before trusting anything in it.
92
+
93
+ ## Verify a presentation
94
+
95
+ ```python
96
+ from ffn_verify import FFN_BUSINESS_REGISTRY, verify_presentation
97
+
98
+ p = verify_presentation(
99
+ {
100
+ "presentation": presentation, # the SD-JWT presentation you received
101
+ "nonce": nonce, # the nonce you issued
102
+ "audience": "https://your-agent.example",
103
+ "issuers": [FFN_BUSINESS_REGISTRY["did"]],
104
+ },
105
+ registry=FFN_BUSINESS_REGISTRY,
106
+ )
107
+ if p["verified"]:
108
+ print(p["subject"], p["vct"], p["claims"])
109
+ ```
110
+
111
+ Delegations take `chain` (parent delegations, nearest first) and `roots` (the DIDs a chain may start at). Credentials from an issuer you don't accept, and chains that don't start at a root you accept, fail before anything is fetched.
112
+
113
+ ## Security
114
+
115
+ - **Pinned keys.** `FFN_BUSINESS_REGISTRY` carries the RFC 7638 thumbprints of the registry's signing key and its standby key. Every known FFN registry is pinned in every function; a custom registry passes `keyThumbprints`.
116
+ - **What it fetches:** the registry (the record and its status lists), the business's `did.json`, and its DNS TXT record over DNS over HTTPS. Everything is HTTPS-only, with no redirects, a size limit on every response and a total deadline on every request.
117
+ - **What it refuses:** private, loopback and link-local addresses, `localhost`, `.local` and `.internal` names. Status lists must be signed by their host's own DID. If you run it inside a sensitive network, send its traffic through an egress proxy as well; that's the only full defense against DNS rebinding.
118
+
119
+ Found a problem? See the [security policy](https://github.com/Sweet-Papa-Technologies/ffn-verify/security/policy).
120
+
121
+ ## Without a library
122
+
123
+ `GET https://registry.fofo.network/v1/verify?domain=…` returns the same result computed by the registry ([OpenAPI](https://registry.fofo.network/openapi.json)), and the registry runs an [MCP server](https://registry.fofo.network/agents#mcp). Both are simpler, but then you trust the registry's server instead of checking its signatures yourself.
124
+
125
+ ## Development
126
+
127
+ ```sh
128
+ pip install -e .
129
+ python -m unittest discover -s tests
130
+ ```
131
+
132
+ The tests replay `../vectors/business/v1.json` when they run inside the [source repository](https://github.com/Sweet-Papa-Technologies/ffn-verify) (or wherever `FFN_VECTORS` points), and skip those cases with a reason otherwise.
133
+
134
+ ## Links
135
+
136
+ [FFN Verified Business](https://registry.fofo.network) · [Guide for agents](https://registry.fofo.network/agents) · [llms.txt](https://registry.fofo.network/llms.txt) · [Source](https://github.com/Sweet-Papa-Technologies/ffn-verify) · [Changelog](https://github.com/Sweet-Papa-Technologies/ffn-verify/blob/main/CHANGELOG.md) · [FoFo Network](https://fofo.network)
137
+
138
+ Apache-2.0. Copyright 2026 Sweet Papa Technologies LLC.
@@ -0,0 +1,111 @@
1
+ <p align="center">
2
+ <a href="https://registry.fofo.network">
3
+ <img src="https://raw.githubusercontent.com/Sweet-Papa-Technologies/ffn-verify/main/assets/ffn-verify-banner.jpg" alt="FFN Verified Business: check a business before your agent trusts it." width="100%">
4
+ </a>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://github.com/Sweet-Papa-Technologies/ffn-verify/actions/workflows/ci.yml"><img src="https://github.com/Sweet-Papa-Technologies/ffn-verify/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
8
+ <a href="https://pypi.org/project/ffn-verify/"><img src="https://img.shields.io/pypi/v/ffn-verify?label=PyPI" alt="PyPI"></a>
9
+ <a href="https://pypi.org/project/ffn-verify/"><img src="https://img.shields.io/pypi/pyversions/ffn-verify" alt="Python versions"></a>
10
+ <a href="https://github.com/Sweet-Papa-Technologies/ffn-verify/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License: Apache-2.0"></a>
11
+ </p>
12
+
13
+ # ffn-verify
14
+
15
+ Verify a business against [FFN Verified Business](https://registry.fofo.network) before your agent or app trusts it. Give it a domain or a phone number; it fetches the business's signed record and checks all of it in your own process: the registry's signature against pinned keys, the business's own signature, the business's domain pointing back to the registry, and the current status of every fact.
16
+
17
+ TypeScript: [`@fofonet/verify-business`](https://www.npmjs.com/package/@fofonet/verify-business). Both pass the same [test vectors](https://github.com/Sweet-Papa-Technologies/ffn-verify/tree/main/vectors).
18
+
19
+ ```sh
20
+ pip install ffn-verify
21
+ ```
22
+
23
+ Python 3.11 or later. Its only dependency is `cryptography`.
24
+
25
+ ## Verify a business
26
+
27
+ ```python
28
+ from ffn_verify import FFN_BUSINESS_REGISTRY, verify_business
29
+
30
+ r = verify_business(
31
+ "sweetpapatechnologies.com",
32
+ registry=FFN_BUSINESS_REGISTRY,
33
+ observed={"name": "Sweet Papa Technologies", "phone": "+1 510-497-0742"},
34
+ )
35
+
36
+ if r["verified"] and r["observedMatches"]:
37
+ print(r["level"], r["levelName"]) # 1 Registered
38
+ print(r["summary"])
39
+ elif r["verified"]:
40
+ print("Listed, but what you were told differs:", r["mismatches"])
41
+ else:
42
+ print(r["failure"]["code"], r["failure"]["message"])
43
+ ```
44
+
45
+ By phone: `verify_business(phone="+15104970742", registry=FFN_BUSINESS_REGISTRY)`. Pass exactly one of `domain` or `phone`. A phone query only counts the business's official channels when the registry confirmed that number.
46
+
47
+ Results are plain dicts with the same keys as the TypeScript package and the HTTP API (`verified`, `observedMatches`, `level`, `levelName`, `business`, `facts`, `binding`, `scope`, `mismatches`, `warnings`, `failure`, `summary`, `checkedAt`). Their meanings, and every `failure.code`, are in the [repository README](https://github.com/Sweet-Papa-Technologies/ffn-verify#what-a-result-means).
48
+
49
+ - **`verified`**: the record, its signatures and the domain binding check out, and the facts for at least Level 1 are current. It's not a rating or a recommendation.
50
+ - **`observedMatches`**: `False` when anything in `observed` differs from the record. Always check it when you pass `observed`: a hacked site can swap in its own phone while the record stays verified.
51
+ - A verified phone means the business controls that number when _you_ call it. It never means an incoming call or text from that number is from the business.
52
+
53
+ ### Options
54
+
55
+ | Keyword | Default | Meaning |
56
+ | ------------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
57
+ | `registry` | required | The registry to trust. `FFN_BUSINESS_REGISTRY` is the production one, with its keys pinned. |
58
+ | `observed` | `None` | What your agent was told: `{"name", "phone", "address"}`, any of them. |
59
+ | `timeout` | `10.0` | Seconds allowed for each request, body included. |
60
+ | `fetch` | built in (urllib) | Your own fetch, for example through an egress proxy. Size limits and deadlines still apply. |
61
+ | `dns` | Cloudflare DNS over HTTPS | A TXT resolver, e.g. `doh_resolver("google")`. |
62
+ | `resolver`, `store` | built in | A DID resolver and a status-list cache, to share between calls. |
63
+
64
+ `lookup_business(registry=..., domain=...)` (or `phone=`) returns the record without the full check. Only the registry's signature is verified, so use `verify_business` before trusting anything in it.
65
+
66
+ ## Verify a presentation
67
+
68
+ ```python
69
+ from ffn_verify import FFN_BUSINESS_REGISTRY, verify_presentation
70
+
71
+ p = verify_presentation(
72
+ {
73
+ "presentation": presentation, # the SD-JWT presentation you received
74
+ "nonce": nonce, # the nonce you issued
75
+ "audience": "https://your-agent.example",
76
+ "issuers": [FFN_BUSINESS_REGISTRY["did"]],
77
+ },
78
+ registry=FFN_BUSINESS_REGISTRY,
79
+ )
80
+ if p["verified"]:
81
+ print(p["subject"], p["vct"], p["claims"])
82
+ ```
83
+
84
+ Delegations take `chain` (parent delegations, nearest first) and `roots` (the DIDs a chain may start at). Credentials from an issuer you don't accept, and chains that don't start at a root you accept, fail before anything is fetched.
85
+
86
+ ## Security
87
+
88
+ - **Pinned keys.** `FFN_BUSINESS_REGISTRY` carries the RFC 7638 thumbprints of the registry's signing key and its standby key. Every known FFN registry is pinned in every function; a custom registry passes `keyThumbprints`.
89
+ - **What it fetches:** the registry (the record and its status lists), the business's `did.json`, and its DNS TXT record over DNS over HTTPS. Everything is HTTPS-only, with no redirects, a size limit on every response and a total deadline on every request.
90
+ - **What it refuses:** private, loopback and link-local addresses, `localhost`, `.local` and `.internal` names. Status lists must be signed by their host's own DID. If you run it inside a sensitive network, send its traffic through an egress proxy as well; that's the only full defense against DNS rebinding.
91
+
92
+ Found a problem? See the [security policy](https://github.com/Sweet-Papa-Technologies/ffn-verify/security/policy).
93
+
94
+ ## Without a library
95
+
96
+ `GET https://registry.fofo.network/v1/verify?domain=…` returns the same result computed by the registry ([OpenAPI](https://registry.fofo.network/openapi.json)), and the registry runs an [MCP server](https://registry.fofo.network/agents#mcp). Both are simpler, but then you trust the registry's server instead of checking its signatures yourself.
97
+
98
+ ## Development
99
+
100
+ ```sh
101
+ pip install -e .
102
+ python -m unittest discover -s tests
103
+ ```
104
+
105
+ The tests replay `../vectors/business/v1.json` when they run inside the [source repository](https://github.com/Sweet-Papa-Technologies/ffn-verify) (or wherever `FFN_VECTORS` points), and skip those cases with a reason otherwise.
106
+
107
+ ## Links
108
+
109
+ [FFN Verified Business](https://registry.fofo.network) · [Guide for agents](https://registry.fofo.network/agents) · [llms.txt](https://registry.fofo.network/llms.txt) · [Source](https://github.com/Sweet-Papa-Technologies/ffn-verify) · [Changelog](https://github.com/Sweet-Papa-Technologies/ffn-verify/blob/main/CHANGELOG.md) · [FoFo Network](https://fofo.network)
110
+
111
+ Apache-2.0. Copyright 2026 Sweet Papa Technologies LLC.
@@ -0,0 +1,45 @@
1
+ """FFN Verified Business public verifier.
2
+
3
+ verify_business(domain): registry record, both signatures, status, domain binding
4
+ and delegation, no wallet needed. A port of @fofonet/verify-business; both replay
5
+ the same test vectors (ffn-pass/vectors/business/v1.json).
6
+
7
+ Data that mirrors the TS JSON (registry anchors, observed facts, presentation
8
+ input, every result) uses the TS camelCase keys; Python names are snake_case.
9
+ """
10
+
11
+ from ._version import __version__
12
+ from .credential import CredentialError, verify_credential
13
+ from .delegation import verify_delegation_chain
14
+ from .did import DidResolver
15
+ from .dns import doh_resolver, static_txt
16
+ from .domain import IdentifierError, normalize_domain, normalize_phone
17
+ from .fetch import urllib_fetch
18
+ from .networks import FFN_BUSINESS_REGISTRY
19
+ from .pin import PinnedRegistryResolver, key_thumbprint, pin_registry_keys
20
+ from .presentation import verify_presentation
21
+ from .status import StatusChecker
22
+ from .verify import VerificationError, lookup_business, verify_business
23
+
24
+ __all__ = [
25
+ "__version__",
26
+ "FFN_BUSINESS_REGISTRY",
27
+ "CredentialError",
28
+ "DidResolver",
29
+ "IdentifierError",
30
+ "PinnedRegistryResolver",
31
+ "StatusChecker",
32
+ "VerificationError",
33
+ "doh_resolver",
34
+ "key_thumbprint",
35
+ "lookup_business",
36
+ "normalize_domain",
37
+ "normalize_phone",
38
+ "pin_registry_keys",
39
+ "static_txt",
40
+ "urllib_fetch",
41
+ "verify_business",
42
+ "verify_credential",
43
+ "verify_delegation_chain",
44
+ "verify_presentation",
45
+ ]