grid402 2.5.0__tar.gz → 2.5.2__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.
- {grid402-2.5.0 → grid402-2.5.2}/PKG-INFO +1 -1
- {grid402-2.5.0 → grid402-2.5.2}/grid402/__init__.py +1 -1
- {grid402-2.5.0 → grid402-2.5.2}/grid402/client.py +5 -4
- {grid402-2.5.0 → grid402-2.5.2}/grid402.egg-info/PKG-INFO +1 -1
- {grid402-2.5.0 → grid402-2.5.2}/pyproject.toml +1 -1
- {grid402-2.5.0 → grid402-2.5.2}/tests/test_sdk.py +11 -6
- {grid402-2.5.0 → grid402-2.5.2}/LICENSE +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/README.md +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402/agentkit.py +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402/exceptions.py +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402/models.py +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402/py.typed +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402.egg-info/SOURCES.txt +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402.egg-info/dependency_links.txt +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402.egg-info/requires.txt +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/grid402.egg-info/top_level.txt +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/setup.cfg +0 -0
- {grid402-2.5.0 → grid402-2.5.2}/tests/test_live_sandbox.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: grid402
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.2
|
|
4
4
|
Summary: SDK Python oficial do Grid402: Micropagamentos HTTP 402 na Base e Prova Criptografica de Oraculo para Agentes Autonomos e IA
|
|
5
5
|
Author-email: Grid402 Team <contato@grid402.online>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,8 +17,8 @@ from grid402.models import OracleVerificationResult, WorkdaysResponse
|
|
|
17
17
|
DEFAULT_ENDPOINT = "https://grid402.online"
|
|
18
18
|
GRID402_ORACLE_WALLET = "0xa592625adbceb8e025ac383f1a3fd8ebb6a63f90"
|
|
19
19
|
DEFAULT_ORACLE_PUBKEY = """-----BEGIN PUBLIC KEY-----
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEq8MF77hj4TAO3ktuRu5GPRdXQP9m9JhO
|
|
21
|
+
c89Y7XGoNGECnG/UiuoqDB/Y7/2s9ww3J7zJ8mC83Zc/Kd0FeDutaQ==
|
|
22
22
|
-----END PUBLIC KEY-----"""
|
|
23
23
|
|
|
24
24
|
|
|
@@ -39,7 +39,7 @@ def canonicalize_payload(data: Any) -> Any:
|
|
|
39
39
|
def compute_data_hash(data: Any) -> str:
|
|
40
40
|
"""Calcula o hash SHA-256 em hexadecimal prefixado com 0x do payload normalizado."""
|
|
41
41
|
clean = canonicalize_payload(data)
|
|
42
|
-
serialized = json.dumps(clean, separators=(",", ":"), sort_keys=True)
|
|
42
|
+
serialized = json.dumps(clean, separators=(",", ":"), sort_keys=True, ensure_ascii=False)
|
|
43
43
|
digest = hashlib.sha256(serialized.encode("utf-8")).hexdigest()
|
|
44
44
|
return f"0x{digest}"
|
|
45
45
|
|
|
@@ -291,7 +291,8 @@ class Grid402Client:
|
|
|
291
291
|
self,
|
|
292
292
|
response: Any,
|
|
293
293
|
expected_oracle_address: Optional[str] = None,
|
|
294
|
+
oracle_public_key: Optional[str] = None,
|
|
294
295
|
) -> OracleVerificationResult:
|
|
295
296
|
"""Valida a prova matematica de autenticidade emitida pelo oraculo Grid402."""
|
|
296
|
-
return verify_oracle_proof(response, expected_oracle_address=expected_oracle_address)
|
|
297
|
+
return verify_oracle_proof(response, expected_oracle_address=expected_oracle_address, oracle_public_key=oracle_public_key)
|
|
297
298
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: grid402
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.2
|
|
4
4
|
Summary: SDK Python oficial do Grid402: Micropagamentos HTTP 402 na Base e Prova Criptografica de Oraculo para Agentes Autonomos e IA
|
|
5
5
|
Author-email: Grid402 Team <contato@grid402.online>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "grid402"
|
|
7
|
-
version = "2.5.
|
|
7
|
+
version = "2.5.2"
|
|
8
8
|
description = "SDK Python oficial do Grid402: Micropagamentos HTTP 402 na Base e Prova Criptografica de Oraculo para Agentes Autonomos e IA"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -39,6 +39,11 @@ FuMG+zevhna+MX1NMJ1+yZ+hRANCAARmHsUjjU6W0zb8/uaJbQv8PQ4ToXMRBGTZ
|
|
|
39
39
|
gmgw8Rc7+YqJnqhKLmX0wIi9L9bsigil7fPURX2thUSwAM6AceQn
|
|
40
40
|
-----END PRIVATE KEY-----"""
|
|
41
41
|
|
|
42
|
+
TEST_ORACLE_PUBKEY_PEM = """-----BEGIN PUBLIC KEY-----
|
|
43
|
+
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEZh7FI41OltM2/P7miW0L/D0OE6FzEQRk
|
|
44
|
+
2YJoMPEXO/mKiZ6oSi5l9MCIvS/W7IoIpe3z1EV9rYVEsADOgHHkJw==
|
|
45
|
+
-----END PUBLIC KEY-----"""
|
|
46
|
+
|
|
42
47
|
|
|
43
48
|
def generate_signed_payload(data: dict, is_sandbox: bool = False) -> dict:
|
|
44
49
|
import time
|
|
@@ -71,7 +76,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
71
76
|
|
|
72
77
|
def test_version_and_exports(self) -> None:
|
|
73
78
|
"""Verifica versao semantica e exportacoes principais."""
|
|
74
|
-
self.assertEqual(__version__, "2.5.
|
|
79
|
+
self.assertEqual(__version__, "2.5.2")
|
|
75
80
|
self.assertTrue(issubclass(Grid402PaymentRequiredError, Grid402Error))
|
|
76
81
|
|
|
77
82
|
def test_pydantic_models(self) -> None:
|
|
@@ -302,7 +307,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
302
307
|
data = {"status": "success", "service": "workdays", "workdays": 5}
|
|
303
308
|
signed = generate_signed_payload(data, is_sandbox=False)
|
|
304
309
|
|
|
305
|
-
res = client.verify_proof(signed)
|
|
310
|
+
res = client.verify_proof(signed, oracle_public_key=TEST_ORACLE_PUBKEY_PEM)
|
|
306
311
|
self.assertTrue(res.valid)
|
|
307
312
|
self.assertEqual(res.oracle_address, GRID402_ORACLE_WALLET.lower())
|
|
308
313
|
self.assertFalse(res.sandbox)
|
|
@@ -315,7 +320,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
315
320
|
|
|
316
321
|
signed["workdays"] = 6
|
|
317
322
|
|
|
318
|
-
res = client.verify_proof(signed)
|
|
323
|
+
res = client.verify_proof(signed, oracle_public_key=TEST_ORACLE_PUBKEY_PEM)
|
|
319
324
|
self.assertFalse(res.valid)
|
|
320
325
|
self.assertEqual(res.error, "DataHashMismatch")
|
|
321
326
|
|
|
@@ -325,7 +330,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
325
330
|
data = {"status": "success", "service": "workdays", "workdays": 5}
|
|
326
331
|
signed = generate_signed_payload(data, is_sandbox=False)
|
|
327
332
|
|
|
328
|
-
res = client.verify_proof(signed, expected_oracle_address="0x000000000000000000000000000000000000dead")
|
|
333
|
+
res = client.verify_proof(signed, expected_oracle_address="0x000000000000000000000000000000000000dead", oracle_public_key=TEST_ORACLE_PUBKEY_PEM)
|
|
329
334
|
self.assertFalse(res.valid)
|
|
330
335
|
self.assertEqual(res.error, "OracleAddressMismatch")
|
|
331
336
|
|
|
@@ -337,7 +342,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
337
342
|
|
|
338
343
|
signed["_oracle_proof"]["signature"] = "0x1234567890abcdef"
|
|
339
344
|
|
|
340
|
-
res = client.verify_proof(signed)
|
|
345
|
+
res = client.verify_proof(signed, oracle_public_key=TEST_ORACLE_PUBKEY_PEM)
|
|
341
346
|
self.assertFalse(res.valid)
|
|
342
347
|
|
|
343
348
|
def test_oracle_proof_sandbox_mode(self) -> None:
|
|
@@ -346,7 +351,7 @@ class TestGrid402SDK(unittest.TestCase):
|
|
|
346
351
|
data = {"status": "success", "service": "indicators", "selic": "10.75"}
|
|
347
352
|
signed = generate_signed_payload(data, is_sandbox=True)
|
|
348
353
|
|
|
349
|
-
res = client.verify_proof(signed)
|
|
354
|
+
res = client.verify_proof(signed, oracle_public_key=TEST_ORACLE_PUBKEY_PEM)
|
|
350
355
|
self.assertTrue(res.valid)
|
|
351
356
|
self.assertTrue(res.sandbox)
|
|
352
357
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|