theprotocol-sdk 0.7.3__tar.gz → 0.7.4__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 (76) hide show
  1. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/PKG-INFO +7 -1
  2. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/README.md +4 -0
  3. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/pyproject.toml +3 -1
  4. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/__init__.py +1 -1
  5. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/payment/mtls_client.py +14 -2
  6. theprotocol_sdk-0.7.4/tests/test_mtls_client_presents_cert.py +108 -0
  7. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/LICENSE +0 -0
  8. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/examples/simple_agent.py +0 -0
  9. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/__init__.py +0 -0
  10. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/base.py +0 -0
  11. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/decorators.py +0 -0
  12. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/router.py +0 -0
  13. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/task_store.py +0 -0
  14. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/agent/well_known.py +0 -0
  15. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/auth/__init__.py +0 -0
  16. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/auth/did_jwt.py +0 -0
  17. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/auth/jws_card.py +0 -0
  18. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/auth/jwt_verifier.py +0 -0
  19. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/authz.py +0 -0
  20. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/__init__.py +0 -0
  21. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/acp.py +0 -0
  22. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/anp/__init__.py +0 -0
  23. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/anp/auth.py +0 -0
  24. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/anp/bridge.py +0 -0
  25. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/anp/did_wba.py +0 -0
  26. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/anp/translation.py +0 -0
  27. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/base.py +0 -0
  28. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/google_a2a.py +0 -0
  29. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/bridges/mcp.py +0 -0
  30. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/client/__init__.py +0 -0
  31. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/client/a2a_client.py +0 -0
  32. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/client/credentials.py +0 -0
  33. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/exceptions.py +0 -0
  34. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/exchange/__init__.py +0 -0
  35. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/exchange/client.py +0 -0
  36. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/forge.py +0 -0
  37. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/guild.py +0 -0
  38. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/messenger.py +0 -0
  39. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/models/__init__.py +0 -0
  40. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/models/a2a_protocol.py +0 -0
  41. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/models/agent_card.py +0 -0
  42. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/models/v1_compat.py +0 -0
  43. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/mtls.py +0 -0
  44. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/payment/__init__.py +0 -0
  45. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/payment/authenticator.py +0 -0
  46. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/payment/client.py +0 -0
  47. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/payment/verifier.py +0 -0
  48. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/registry/__init__.py +0 -0
  49. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/registry/card_verify.py +0 -0
  50. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/registry/cost_composition.py +0 -0
  51. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/transfer/__init__.py +0 -0
  52. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/src/theprotocol/transfer/client.py +0 -0
  53. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/registry/__init__.py +0 -0
  54. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/registry/test_card_verify.py +0 -0
  55. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/registry/test_cost_composition.py +0 -0
  56. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_agent.py +0 -0
  57. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_artifact_roundtrip.py +0 -0
  58. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_auth.py +0 -0
  59. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_authz.py +0 -0
  60. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_bridge_acp.py +0 -0
  61. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_bridge_anp.py +0 -0
  62. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_bridge_google_a2a.py +0 -0
  63. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_bridge_mcp.py +0 -0
  64. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_credentials.py +0 -0
  65. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_did_jwt.py +0 -0
  66. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_exchange_launch.py +0 -0
  67. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_forge.py +0 -0
  68. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_guild.py +0 -0
  69. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_jws_card.py +0 -0
  70. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_messenger.py +0 -0
  71. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_models.py +0 -0
  72. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_mtls_enroll.py +0 -0
  73. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_transfer.py +0 -0
  74. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_v1_compat.py +0 -0
  75. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_verifier_reuse.py +0 -0
  76. {theprotocol_sdk-0.7.3 → theprotocol_sdk-0.7.4}/tests/test_well_known.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: theprotocol-sdk
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Build sovereign AI agents with DID identity on TheProtocol. Speaks the A2A protocol (v1.0) natively, with bridges for Google A2A, ANP, and MCP. Works with Vertex AI, AWS AgentCore, LangGraph, CrewAI.
5
5
  Project-URL: Homepage, https://theprotocol.cloud
6
6
  Project-URL: Documentation, https://docs.theprotocol.cloud
@@ -16,6 +16,8 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
19
21
  Classifier: Topic :: Software Development :: Libraries
20
22
  Requires-Python: >=3.10
21
23
  Requires-Dist: httpx[http2]>=0.27
@@ -183,6 +185,10 @@ The private key is written `0600` into a `0700` directory, via a temp file and r
183
185
 
184
186
  ## Changelog
185
187
 
188
+ **0.7.4** (2026-09-29)
189
+ - `MtlsAgentClient` presents its SVID on every httpx: it builds one `SSLContext` holding the peer bundle AND the client certificate. httpx 0.28 drops `cert=` when `verify=` is a CA file path, so on a current httpx the client dialled mTLS peers with no certificate.
190
+ - Tested on Python 3.13 and 3.14 (classifiers added). Python 3.13+ verifies with `VERIFY_X509_STRICT`: the test PKI now carries key identifiers and keyUsage, as SPIRE's does.
191
+
186
192
  **0.7.3** (2026-09-22)
187
193
  - `ExchangeClient` speaks the documented `/api/v1/agora` paths. Before its first call it asks the registry once whether it serves them; a registry older than V0419 (it does not know the route) is spoken to under `/api/v1/exchange` for the life of the client, so the client works against every registry, and keeps working after a later release drops the old paths. `launch_buy` posts to `launch/buy` (an older registry is sent its `ipo/buy`). `ExchangeClient.base` holds the resolved path.
188
194
  - The build backend is pinned (`hatchling==1.27.0`), so every release carries the same package metadata version.
@@ -142,6 +142,10 @@ The private key is written `0600` into a `0700` directory, via a temp file and r
142
142
 
143
143
  ## Changelog
144
144
 
145
+ **0.7.4** (2026-09-29)
146
+ - `MtlsAgentClient` presents its SVID on every httpx: it builds one `SSLContext` holding the peer bundle AND the client certificate. httpx 0.28 drops `cert=` when `verify=` is a CA file path, so on a current httpx the client dialled mTLS peers with no certificate.
147
+ - Tested on Python 3.13 and 3.14 (classifiers added). Python 3.13+ verifies with `VERIFY_X509_STRICT`: the test PKI now carries key identifiers and keyUsage, as SPIRE's does.
148
+
145
149
  **0.7.3** (2026-09-22)
146
150
  - `ExchangeClient` speaks the documented `/api/v1/agora` paths. Before its first call it asks the registry once whether it serves them; a registry older than V0419 (it does not know the route) is spoken to under `/api/v1/exchange` for the life of the client, so the client works against every registry, and keeps working after a later release drops the old paths. `launch_buy` posts to `launch/buy` (an older registry is sent its `ipo/buy`). `ExchangeClient.base` holds the resolved path.
147
151
  - The build backend is pinned (`hatchling==1.27.0`), so every release carries the same package metadata version.
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "theprotocol-sdk"
9
- version = "0.7.3"
9
+ version = "0.7.4"
10
10
  description = "Build sovereign AI agents with DID identity on TheProtocol. Speaks the A2A protocol (v1.0) natively, with bridges for Google A2A, ANP, and MCP. Works with Vertex AI, AWS AgentCore, LangGraph, CrewAI."
11
11
  readme = "README.md"
12
12
  license = {text = "Apache-2.0"}
@@ -23,6 +23,8 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3.10",
24
24
  "Programming Language :: Python :: 3.11",
25
25
  "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Programming Language :: Python :: 3.14",
26
28
  "Topic :: Software Development :: Libraries",
27
29
  ]
28
30
  dependencies = [
@@ -14,4 +14,4 @@ Usage:
14
14
  from theprotocol.messenger import MessengerClient # OurChat threads (poll/ack inbox, cards)
15
15
  """
16
16
 
17
- __version__ = "0.7.3"
17
+ __version__ = "0.7.4"
@@ -119,7 +119,7 @@ class MtlsAgentClient:
119
119
 
120
120
  async with httpx.AsyncClient(
121
121
  cert=self.cert,
122
- verify=self.bundle_path,
122
+ verify=self._verify(),
123
123
  timeout=self.timeout,
124
124
  ) as client:
125
125
  response = await client.post(
@@ -128,11 +128,23 @@ class MtlsAgentClient:
128
128
  response.raise_for_status()
129
129
  return response.json()
130
130
 
131
+ def _verify(self) -> Any:
132
+ """What httpx gets as `verify=`: the bundle and the SVID in ONE SSLContext.
133
+
134
+ httpx >= 0.28 drops `cert=` when `verify=` is a CA file path (it returns the context built from the path before
135
+ it reaches the client-certificate step), so with a current httpx this client presented NO certificate. A
136
+ context holding the chain is honoured by every httpx version and is the only form httpx 1.0 accepts.
137
+ """
138
+ import ssl
139
+ ctx = ssl.create_default_context(cafile=self.bundle_path)
140
+ ctx.load_cert_chain(*self.cert)
141
+ return ctx
142
+
131
143
  async def health_check(self, url: str) -> Dict[str, Any]:
132
144
  """Check an agent's health endpoint over mTLS."""
133
145
  async with httpx.AsyncClient(
134
146
  cert=self.cert,
135
- verify=self.bundle_path,
147
+ verify=self._verify(),
136
148
  timeout=10.0,
137
149
  ) as client:
138
150
  response = await client.get(url)
@@ -0,0 +1,108 @@
1
+ """§DEPS (2026-09-27): MtlsAgentClient PRESENTS its SVID to a peer that requires a client certificate, on any httpx.
2
+
3
+ httpx >= 0.28 drops `cert=` when `verify=` is a CA file path: it returns the context built from the path before it
4
+ reaches the client-certificate step (only a DeprecationWarning, hidden by default). This client passed exactly that
5
+ pair, and the SDK allows any httpx >= 0.27, so an agent installed with a current httpx dialled every mTLS peer with no
6
+ certificate. This test does a real TLS handshake against a local server that REQUIRES one.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import asyncio
11
+ import datetime
12
+ import http.server
13
+ import ipaddress
14
+ import json
15
+ import ssl
16
+ import threading
17
+
18
+ import pytest
19
+ from cryptography import x509
20
+ from cryptography.hazmat.primitives import hashes, serialization
21
+ from cryptography.hazmat.primitives.asymmetric import ec
22
+ from cryptography.x509.oid import ExtendedKeyUsageOID, NameOID
23
+
24
+ from theprotocol.payment.mtls_client import MtlsAgentClient
25
+
26
+
27
+ def _name(cn):
28
+ return x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, cn)])
29
+
30
+
31
+ def _issue(subject, key, issuer_name, issuer_key, *, ca, san=None, eku=None):
32
+ # Python >= 3.13 verifies with ssl.VERIFY_X509_STRICT: a chain without key identifiers, or a CA without keyUsage, is
33
+ # refused ("Missing Authority Key Identifier"), so this PKI carries what a real one (SPIRE's) carries.
34
+ now = datetime.datetime.now(datetime.timezone.utc)
35
+ b = (x509.CertificateBuilder().subject_name(_name(subject)).issuer_name(issuer_name)
36
+ .public_key(key.public_key()).serial_number(x509.random_serial_number())
37
+ .not_valid_before(now - datetime.timedelta(minutes=5)).not_valid_after(now + datetime.timedelta(hours=1))
38
+ .add_extension(x509.BasicConstraints(ca=ca, path_length=None), critical=True)
39
+ .add_extension(x509.SubjectKeyIdentifier.from_public_key(key.public_key()), critical=False)
40
+ .add_extension(x509.AuthorityKeyIdentifier.from_issuer_public_key(issuer_key.public_key()), critical=False)
41
+ .add_extension(x509.KeyUsage(digital_signature=not ca, content_commitment=False, key_encipherment=False,
42
+ data_encipherment=False, key_agreement=False, key_cert_sign=ca, crl_sign=ca,
43
+ encipher_only=False, decipher_only=False), critical=True))
44
+ if san is not None:
45
+ b = b.add_extension(san, critical=False)
46
+ if eku is not None:
47
+ b = b.add_extension(x509.ExtendedKeyUsage(eku), critical=False)
48
+ return b.sign(issuer_key, hashes.SHA256())
49
+
50
+
51
+ @pytest.fixture(scope="module")
52
+ def cert_dir(tmp_path_factory):
53
+ d = tmp_path_factory.mktemp("svid")
54
+ ca_key = ec.generate_private_key(ec.SECP256R1())
55
+ ca = _issue("test-ca", ca_key, _name("test-ca"), ca_key, ca=True)
56
+ srv_key, cli_key = ec.generate_private_key(ec.SECP256R1()), ec.generate_private_key(ec.SECP256R1())
57
+ srv = _issue("localhost", srv_key, ca.subject, ca_key, ca=False,
58
+ san=x509.SubjectAlternativeName([x509.DNSName("localhost"), x509.IPAddress(ipaddress.ip_address("127.0.0.1"))]),
59
+ eku=[ExtendedKeyUsageOID.SERVER_AUTH])
60
+ cli = _issue("agent", cli_key, ca.subject, ca_key, ca=False,
61
+ san=x509.SubjectAlternativeName([x509.UniformResourceIdentifier("spiffe://test.local/agent/a1")]),
62
+ eku=[ExtendedKeyUsageOID.CLIENT_AUTH])
63
+ pem = lambda c: c.public_bytes(serialization.Encoding.PEM) # noqa: E731
64
+ kpem = lambda k: k.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, # noqa: E731
65
+ serialization.NoEncryption())
66
+ (d / "bundle.pem").write_bytes(pem(ca))
67
+ (d / "svid.pem").write_bytes(pem(cli)); (d / "key.pem").write_bytes(kpem(cli_key))
68
+ (d / "srv.pem").write_bytes(pem(srv)); (d / "srv.key").write_bytes(kpem(srv_key))
69
+ return d
70
+
71
+
72
+ @pytest.fixture(scope="module")
73
+ def peer(cert_dir):
74
+ seen = []
75
+
76
+ class H(http.server.BaseHTTPRequestHandler):
77
+ def do_GET(self): # noqa: N802
78
+ seen.append(self.connection.getpeercert() or {})
79
+ body = json.dumps({"ok": True}).encode()
80
+ self.send_response(200); self.send_header("Content-Type", "application/json")
81
+ self.send_header("Content-Length", str(len(body))); self.end_headers(); self.wfile.write(body)
82
+
83
+ def log_message(self, *a):
84
+ pass
85
+
86
+ ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
87
+ ctx.load_cert_chain(str(cert_dir / "srv.pem"), str(cert_dir / "srv.key"))
88
+ ctx.load_verify_locations(cafile=str(cert_dir / "bundle.pem"))
89
+ ctx.verify_mode = ssl.CERT_REQUIRED
90
+ httpd = http.server.HTTPServer(("127.0.0.1", 0), H)
91
+ httpd.socket = ctx.wrap_socket(httpd.socket, server_side=True)
92
+ threading.Thread(target=httpd.serve_forever, daemon=True).start()
93
+ try:
94
+ yield f"https://127.0.0.1:{httpd.server_address[1]}/health", seen
95
+ finally:
96
+ httpd.shutdown()
97
+
98
+
99
+ def test_the_client_presents_its_svid(peer, cert_dir):
100
+ url, seen = peer
101
+ client = MtlsAgentClient(cert_dir=str(cert_dir))
102
+ loop = asyncio.new_event_loop()
103
+ try:
104
+ body = loop.run_until_complete(client.health_check(url))
105
+ finally:
106
+ loop.close()
107
+ assert body == {"ok": True}
108
+ assert seen and seen[-1], "the peer saw no client certificate"
File without changes