verdifax 0.2.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 (36) hide show
  1. verdifax-0.2.0/LICENSE +21 -0
  2. verdifax-0.2.0/MANIFEST.in +10 -0
  3. verdifax-0.2.0/PKG-INFO +137 -0
  4. verdifax-0.2.0/README.md +96 -0
  5. verdifax-0.2.0/pyproject.toml +94 -0
  6. verdifax-0.2.0/requirements-dev.txt +8 -0
  7. verdifax-0.2.0/requirements.txt +3 -0
  8. verdifax-0.2.0/setup.cfg +37 -0
  9. verdifax-0.2.0/tests/__init__.py +0 -0
  10. verdifax-0.2.0/tests/conftest.py +85 -0
  11. verdifax-0.2.0/tests/test_async_client.py +246 -0
  12. verdifax-0.2.0/tests/test_client.py +383 -0
  13. verdifax-0.2.0/tests/test_determinism.py +59 -0
  14. verdifax-0.2.0/tests/test_exceptions.py +41 -0
  15. verdifax-0.2.0/tests/test_helpers.py +123 -0
  16. verdifax-0.2.0/tests/test_integration.py +83 -0
  17. verdifax-0.2.0/tests/test_models.py +175 -0
  18. verdifax-0.2.0/tests/test_section0_vectors.py +314 -0
  19. verdifax-0.2.0/tests/test_validation.py +80 -0
  20. verdifax-0.2.0/verdifax/__init__.py +147 -0
  21. verdifax-0.2.0/verdifax/_transport.py +61 -0
  22. verdifax-0.2.0/verdifax/_validation.py +61 -0
  23. verdifax-0.2.0/verdifax/_version.py +3 -0
  24. verdifax-0.2.0/verdifax/async_client.py +208 -0
  25. verdifax-0.2.0/verdifax/client.py +235 -0
  26. verdifax-0.2.0/verdifax/exceptions.py +87 -0
  27. verdifax-0.2.0/verdifax/helpers.py +105 -0
  28. verdifax-0.2.0/verdifax/models.py +357 -0
  29. verdifax-0.2.0/verdifax/py.typed +0 -0
  30. verdifax-0.2.0/verdifax/section0.py +279 -0
  31. verdifax-0.2.0/verdifax.egg-info/PKG-INFO +137 -0
  32. verdifax-0.2.0/verdifax.egg-info/SOURCES.txt +35 -0
  33. verdifax-0.2.0/verdifax.egg-info/dependency_links.txt +1 -0
  34. verdifax-0.2.0/verdifax.egg-info/not-zip-safe +1 -0
  35. verdifax-0.2.0/verdifax.egg-info/requires.txt +11 -0
  36. verdifax-0.2.0/verdifax.egg-info/top_level.txt +1 -0
verdifax-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Verdifax
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ include requirements.txt
5
+ include requirements-dev.txt
6
+ include verdifax/py.typed
7
+ recursive-include tests *.py
8
+ global-exclude __pycache__
9
+ global-exclude *.py[cod]
10
+ global-exclude *.so
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: verdifax
3
+ Version: 0.2.0
4
+ Summary: Python SDK for the Verdifax cryptographic attestation pipeline
5
+ Home-page: https://verdifax.com
6
+ Author: Verdifax
7
+ Author-email: Verdifax <team@verdifax.com>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://verdifax.com
10
+ Project-URL: Documentation, https://docs.verdifax.com
11
+ Project-URL: Repository, https://github.com/verdifax/verdifax-sdk-python
12
+ Project-URL: Issues, https://github.com/verdifax/verdifax-sdk-python/issues
13
+ Keywords: verdifax,attestation,ai,audit,compliance,manifest,hash,provenance
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
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 :: Only
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Security :: Cryptography
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: httpx>=0.25.0
31
+ Requires-Dist: pydantic<3.0,>=2.0
32
+ Requires-Dist: typing-extensions>=4.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0; extra == "dev"
35
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
36
+ Requires-Dist: respx>=0.20; extra == "dev"
37
+ Requires-Dist: black>=23.0; extra == "dev"
38
+ Requires-Dist: mypy>=1.5; extra == "dev"
39
+ Requires-Dist: build>=1.0; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # Verdifax Python SDK
43
+
44
+ Cryptographic attestation for AI inference. Three lines: send a payload, get a signed manifest hash you can give to an auditor.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install verdifax
50
+ ```
51
+
52
+ ## Quickstart
53
+
54
+ ```python
55
+ import verdifax
56
+
57
+ receipt = verdifax.attest(
58
+ payload="hello verdifax",
59
+ program_id="a" * 64,
60
+ route_id="route-test",
61
+ registry_record_hash="b" * 64,
62
+ )
63
+ print(receipt.manifest_hash)
64
+ ```
65
+
66
+ That's it. The receipt's `manifest_hash` is a 64-char SHA-256 that seals every input, every kernel execution ID, the hardware attestation, the ZK transcript, the formal verifier status, and the final VFA. Anyone with the same inputs can re-derive the same hash.
67
+
68
+ ## Configuration
69
+
70
+ By default the SDK talks to a Verdifax API at `http://localhost:9090` (the orchestrator's REST server). Override with environment variables:
71
+
72
+ ```bash
73
+ export VERDIFAX_API_URL=https://api.verdifax.example.com
74
+ export VERDIFAX_API_KEY=your-api-key
75
+ ```
76
+
77
+ Or construct a client explicitly:
78
+
79
+ ```python
80
+ from verdifax import VerdifaxClient
81
+
82
+ client = VerdifaxClient(base_url="https://api.verdifax.example.com", api_key="...")
83
+ receipt = client.attest(payload="...", program_id="...", route_id="...", registry_record_hash="...")
84
+ ```
85
+
86
+ ## Async
87
+
88
+ ```python
89
+ import asyncio
90
+ from verdifax import AsyncVerdifaxClient
91
+
92
+ async def main():
93
+ async with AsyncVerdifaxClient() as client:
94
+ receipt = await client.attest(
95
+ payload="hello verdifax",
96
+ program_id="a" * 64,
97
+ route_id="route-test",
98
+ registry_record_hash="b" * 64,
99
+ )
100
+ print(receipt.manifest_hash)
101
+
102
+ asyncio.run(main())
103
+ ```
104
+
105
+ ## Verification
106
+
107
+ Re-derive the manifest hash from the same inputs and confirm it matches a previously issued receipt:
108
+
109
+ ```python
110
+ ok = client.verify(
111
+ manifest_hash=receipt.manifest_hash,
112
+ payload="hello verdifax",
113
+ program_id="a" * 64,
114
+ route_id="route-test",
115
+ registry_record_hash="b" * 64,
116
+ )
117
+ ```
118
+
119
+ ## Helpers for popular providers
120
+
121
+ ```python
122
+ import verdifax
123
+
124
+ receipt = verdifax.attest_claude_response(
125
+ prompt="What is the boiling point of water?",
126
+ response="100 °C at sea level.",
127
+ program_id="a" * 64,
128
+ route_id="claude-route",
129
+ registry_record_hash="b" * 64,
130
+ )
131
+ ```
132
+
133
+ There is also `verdifax.attest_openai_response(...)` with the same signature.
134
+
135
+ ## License
136
+
137
+ MIT
@@ -0,0 +1,96 @@
1
+ # Verdifax Python SDK
2
+
3
+ Cryptographic attestation for AI inference. Three lines: send a payload, get a signed manifest hash you can give to an auditor.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install verdifax
9
+ ```
10
+
11
+ ## Quickstart
12
+
13
+ ```python
14
+ import verdifax
15
+
16
+ receipt = verdifax.attest(
17
+ payload="hello verdifax",
18
+ program_id="a" * 64,
19
+ route_id="route-test",
20
+ registry_record_hash="b" * 64,
21
+ )
22
+ print(receipt.manifest_hash)
23
+ ```
24
+
25
+ That's it. The receipt's `manifest_hash` is a 64-char SHA-256 that seals every input, every kernel execution ID, the hardware attestation, the ZK transcript, the formal verifier status, and the final VFA. Anyone with the same inputs can re-derive the same hash.
26
+
27
+ ## Configuration
28
+
29
+ By default the SDK talks to a Verdifax API at `http://localhost:9090` (the orchestrator's REST server). Override with environment variables:
30
+
31
+ ```bash
32
+ export VERDIFAX_API_URL=https://api.verdifax.example.com
33
+ export VERDIFAX_API_KEY=your-api-key
34
+ ```
35
+
36
+ Or construct a client explicitly:
37
+
38
+ ```python
39
+ from verdifax import VerdifaxClient
40
+
41
+ client = VerdifaxClient(base_url="https://api.verdifax.example.com", api_key="...")
42
+ receipt = client.attest(payload="...", program_id="...", route_id="...", registry_record_hash="...")
43
+ ```
44
+
45
+ ## Async
46
+
47
+ ```python
48
+ import asyncio
49
+ from verdifax import AsyncVerdifaxClient
50
+
51
+ async def main():
52
+ async with AsyncVerdifaxClient() as client:
53
+ receipt = await client.attest(
54
+ payload="hello verdifax",
55
+ program_id="a" * 64,
56
+ route_id="route-test",
57
+ registry_record_hash="b" * 64,
58
+ )
59
+ print(receipt.manifest_hash)
60
+
61
+ asyncio.run(main())
62
+ ```
63
+
64
+ ## Verification
65
+
66
+ Re-derive the manifest hash from the same inputs and confirm it matches a previously issued receipt:
67
+
68
+ ```python
69
+ ok = client.verify(
70
+ manifest_hash=receipt.manifest_hash,
71
+ payload="hello verdifax",
72
+ program_id="a" * 64,
73
+ route_id="route-test",
74
+ registry_record_hash="b" * 64,
75
+ )
76
+ ```
77
+
78
+ ## Helpers for popular providers
79
+
80
+ ```python
81
+ import verdifax
82
+
83
+ receipt = verdifax.attest_claude_response(
84
+ prompt="What is the boiling point of water?",
85
+ response="100 °C at sea level.",
86
+ program_id="a" * 64,
87
+ route_id="claude-route",
88
+ registry_record_hash="b" * 64,
89
+ )
90
+ ```
91
+
92
+ There is also `verdifax.attest_openai_response(...)` with the same signature.
93
+
94
+ ## License
95
+
96
+ MIT
@@ -0,0 +1,94 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "verdifax"
7
+ version = "0.2.0"
8
+ description = "Python SDK for the Verdifax cryptographic attestation pipeline"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "Verdifax", email = "team@verdifax.com" },
15
+ ]
16
+ keywords = [
17
+ "verdifax",
18
+ "attestation",
19
+ "ai",
20
+ "audit",
21
+ "compliance",
22
+ "manifest",
23
+ "hash",
24
+ "provenance",
25
+ ]
26
+ classifiers = [
27
+ "Development Status :: 4 - Beta",
28
+ "Intended Audience :: Developers",
29
+ "Intended Audience :: Information Technology",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3 :: Only",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ "Topic :: Security :: Cryptography",
39
+ "Typing :: Typed",
40
+ ]
41
+ dependencies = [
42
+ "httpx>=0.25.0",
43
+ "pydantic>=2.0,<3.0",
44
+ "typing-extensions>=4.0",
45
+ ]
46
+
47
+ [project.optional-dependencies]
48
+ dev = [
49
+ "pytest>=7.0",
50
+ "pytest-asyncio>=0.21",
51
+ "respx>=0.20",
52
+ "black>=23.0",
53
+ "mypy>=1.5",
54
+ "build>=1.0",
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://verdifax.com"
59
+ Documentation = "https://docs.verdifax.com"
60
+ Repository = "https://github.com/verdifax/verdifax-sdk-python"
61
+ Issues = "https://github.com/verdifax/verdifax-sdk-python/issues"
62
+
63
+ [tool.setuptools.packages.find]
64
+ where = ["."]
65
+ include = ["verdifax*"]
66
+ exclude = ["tests*"]
67
+
68
+ [tool.setuptools.package-data]
69
+ verdifax = ["py.typed"]
70
+
71
+ [tool.black]
72
+ line-length = 100
73
+ target-version = ["py39"]
74
+
75
+ [tool.mypy]
76
+ strict = true
77
+ python_version = "3.9"
78
+ warn_unused_ignores = true
79
+ warn_redundant_casts = true
80
+ warn_return_any = true
81
+ disallow_untyped_defs = true
82
+ disallow_incomplete_defs = true
83
+
84
+ [[tool.mypy.overrides]]
85
+ module = "tests.*"
86
+ disallow_untyped_defs = false
87
+
88
+ [tool.pytest.ini_options]
89
+ testpaths = ["tests"]
90
+ asyncio_mode = "auto"
91
+ filterwarnings = [
92
+ "error",
93
+ "ignore::DeprecationWarning:pydantic.*",
94
+ ]
@@ -0,0 +1,8 @@
1
+ -r requirements.txt
2
+ pytest>=7.0
3
+ pytest-asyncio>=0.21
4
+ respx>=0.20
5
+ black>=23.0
6
+ mypy>=1.5
7
+ build>=1.0
8
+ twine>=4.0
@@ -0,0 +1,3 @@
1
+ httpx>=0.25.0
2
+ pydantic>=2.0,<3.0
3
+ typing-extensions>=4.0
@@ -0,0 +1,37 @@
1
+ [metadata]
2
+ name = verdifax
3
+ version = 0.1.0
4
+ description = Python SDK for the Verdifax cryptographic attestation pipeline
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ url = https://verdifax.com
8
+ author = Verdifax
9
+ author_email = team@verdifax.com
10
+ license_files = LICENSE
11
+ classifiers =
12
+ Development Status :: 4 - Beta
13
+ Intended Audience :: Developers
14
+ Intended Audience :: Information Technology
15
+ Operating System :: OS Independent
16
+ Programming Language :: Python :: 3
17
+ Programming Language :: Python :: 3.9
18
+ Programming Language :: Python :: 3.10
19
+ Programming Language :: Python :: 3.11
20
+ Programming Language :: Python :: 3.12
21
+ Programming Language :: Python :: 3 :: Only
22
+ Topic :: Software Development :: Libraries :: Python Modules
23
+ Topic :: Security :: Cryptography
24
+ Typing :: Typed
25
+
26
+ [options]
27
+ python_requires = >=3.9
28
+ include_package_data = True
29
+ zip_safe = False
30
+
31
+ [options.package_data]
32
+ verdifax = py.typed
33
+
34
+ [egg_info]
35
+ tag_build =
36
+ tag_date = 0
37
+
File without changes
@@ -0,0 +1,85 @@
1
+ """Shared pytest fixtures and helpers.
2
+
3
+ The fixtures here build canonical valid inputs (a 64-char program_id,
4
+ a route_id, a registry record hash) and a representative API response
5
+ body so tests do not need to rebuild them inline.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Any
11
+
12
+ import pytest
13
+
14
+
15
+ PROGRAM_ID = "a" * 64
16
+ ROUTE_ID = "route-test"
17
+ REGISTRY_RECORD_HASH = "b" * 64
18
+ MANIFEST_HASH = "9" * 64
19
+
20
+
21
+ def _hash_field(seed: str) -> str:
22
+ """Build a deterministic 64-char hex string for fixtures."""
23
+ return (seed * 64)[:64]
24
+
25
+
26
+ def make_manifest_dict(manifest_hash: str = MANIFEST_HASH) -> dict[str, Any]:
27
+ """A manifest body shaped exactly the way the Go API serializes it."""
28
+ return {
29
+ "EnvelopeID": "env-0001",
30
+ "EnvelopeHash": _hash_field("1"),
31
+ "SequenceID": "seq-0001",
32
+ "TransportHash": _hash_field("2"),
33
+ "EpaHash": _hash_field("3"),
34
+ "EfaHash": _hash_field("4"),
35
+ "ExecutionIDs": [
36
+ "dse-id",
37
+ "tok-id",
38
+ "dsc-id",
39
+ "nrep-id",
40
+ "aivp-id",
41
+ "dcae-id",
42
+ ],
43
+ "AerHash": _hash_field("5"),
44
+ "TranscriptHash": _hash_field("6"),
45
+ "HardwareAttestationHash": _hash_field("7"),
46
+ "LeakageBundleHash": _hash_field("8"),
47
+ "FormalVerifierStatus": "VERIFIED_SOUND_COMPLETE_ZK",
48
+ "ZkspBindingHash": _hash_field("a"),
49
+ "MigrationTokenHash": _hash_field("b"),
50
+ "ReplayFingerprint": _hash_field("c"),
51
+ "PoteProofHash": _hash_field("d"),
52
+ "LogEntryID": "log-0001",
53
+ "RegistryArtifactCount": 18,
54
+ "FinalVfaHash": _hash_field("e"),
55
+ "IndependentVerified": True,
56
+ "ManifestHash": manifest_hash,
57
+ }
58
+
59
+
60
+ def make_execute_response(manifest_hash: str = MANIFEST_HASH) -> dict[str, Any]:
61
+ """A full POST /execute success response body."""
62
+ return {
63
+ "ok": True,
64
+ "duration_ms": 42,
65
+ "manifest": make_manifest_dict(manifest_hash=manifest_hash),
66
+ }
67
+
68
+
69
+ @pytest.fixture
70
+ def manifest_dict() -> dict[str, Any]:
71
+ return make_manifest_dict()
72
+
73
+
74
+ @pytest.fixture
75
+ def execute_response() -> dict[str, Any]:
76
+ return make_execute_response()
77
+
78
+
79
+ @pytest.fixture
80
+ def valid_inputs() -> dict[str, str]:
81
+ return {
82
+ "program_id": PROGRAM_ID,
83
+ "route_id": ROUTE_ID,
84
+ "registry_record_hash": REGISTRY_RECORD_HASH,
85
+ }