shield-python 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- shield/__init__.py +1 -1
- shield/client.py +5 -2
- {shield_python-0.1.0.dist-info → shield_python-0.1.2.dist-info}/METADATA +6 -6
- {shield_python-0.1.0.dist-info → shield_python-0.1.2.dist-info}/RECORD +6 -6
- {shield_python-0.1.0.dist-info → shield_python-0.1.2.dist-info}/WHEEL +0 -0
- {shield_python-0.1.0.dist-info → shield_python-0.1.2.dist-info}/top_level.txt +0 -0
shield/__init__.py
CHANGED
shield/client.py
CHANGED
|
@@ -18,7 +18,7 @@ class Client:
|
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
api_key: Your Shield API key.
|
|
21
|
-
base_url: Base URL for the Shield API. Defaults to https://getshield.dev/
|
|
21
|
+
base_url: Base URL for the Shield API. Defaults to https://api.getshield.dev/v1.
|
|
22
22
|
hmac_secret: Optional HMAC secret for request signing.
|
|
23
23
|
timeout: Request timeout in seconds. Defaults to 30.
|
|
24
24
|
"""
|
|
@@ -26,7 +26,7 @@ class Client:
|
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
28
|
api_key: str,
|
|
29
|
-
base_url: str = "https://getshield.dev/
|
|
29
|
+
base_url: str = "https://api.getshield.dev/v1",
|
|
30
30
|
hmac_secret: Optional[str] = None,
|
|
31
31
|
timeout: int = 30,
|
|
32
32
|
):
|
|
@@ -79,7 +79,9 @@ class Client:
|
|
|
79
79
|
|
|
80
80
|
# HMAC signing
|
|
81
81
|
if self.hmac_secret:
|
|
82
|
+
import uuid
|
|
82
83
|
timestamp = str(int(time.time()))
|
|
84
|
+
nonce = str(uuid.uuid4())
|
|
83
85
|
body_hash = hashlib.sha256(body).hexdigest()
|
|
84
86
|
message = f"{timestamp}.{method}.{path}.{body_hash}"
|
|
85
87
|
signature = hmac_mod.new(
|
|
@@ -89,6 +91,7 @@ class Client:
|
|
|
89
91
|
).hexdigest()
|
|
90
92
|
headers["X-Shield-Signature"] = signature
|
|
91
93
|
headers["X-Shield-Timestamp"] = timestamp
|
|
94
|
+
headers["X-Shield-Nonce"] = nonce
|
|
92
95
|
|
|
93
96
|
try:
|
|
94
97
|
response = self._session.request(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shield-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Official Shield SDK for Python
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://getshield.dev
|
|
@@ -11,7 +11,7 @@ Requires-Dist: requests>=2.28.0
|
|
|
11
11
|
|
|
12
12
|
# Shield Python SDK
|
|
13
13
|
|
|
14
|
-
Official Python SDK for [Shield](https://getshield.dev)
|
|
14
|
+
Official Python SDK for [Shield](https://getshield.dev) ??tamper-evident session recording for online business transactions.
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ import shield
|
|
|
27
27
|
client = shield.Client(api_key="sk_live_your_api_key")
|
|
28
28
|
|
|
29
29
|
# Create a session
|
|
30
|
-
session = client.sessions.create(title="
|
|
30
|
+
session = client.sessions.create(title="Contract Negotiation with Acme Corp")
|
|
31
31
|
session_id = session["id"]
|
|
32
32
|
|
|
33
33
|
# Record events
|
|
@@ -75,8 +75,8 @@ client = shield.Client(
|
|
|
75
75
|
|
|
76
76
|
When an HMAC secret is configured, the SDK computes a signature for each request:
|
|
77
77
|
|
|
78
|
-
- `X-Shield-Timestamp`
|
|
79
|
-
- `X-Shield-Signature`
|
|
78
|
+
- `X-Shield-Timestamp` ??Unix timestamp of the request
|
|
79
|
+
- `X-Shield-Signature` ??HMAC-SHA256 of `{timestamp}.{METHOD}.{path}.{SHA256(body)}`
|
|
80
80
|
|
|
81
81
|
The server validates these headers to ensure requests have not been tampered with or replayed.
|
|
82
82
|
|
|
@@ -192,7 +192,7 @@ async def verify_session(session_id: str):
|
|
|
192
192
|
|
|
193
193
|
## Event Types Reference
|
|
194
194
|
|
|
195
|
-
Shield Standard Event Taxonomy v1.0
|
|
195
|
+
Shield Standard Event Taxonomy v1.0 ??37 event types across 7 categories:
|
|
196
196
|
|
|
197
197
|
### Party Events
|
|
198
198
|
| Event Type | Description |
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
shield/__init__.py,sha256=
|
|
2
|
-
shield/client.py,sha256=
|
|
1
|
+
shield/__init__.py,sha256=tVgmZav-V2324i1l9m63R46bBn9aGRzccKyo_QfpJ8E,122
|
|
2
|
+
shield/client.py,sha256=91j-u9Bn-8fzarn37UYvClcMMwEMJRit1OsPfq8nfxM,4083
|
|
3
3
|
shield/exceptions.py,sha256=PunpNnkqyP-9ZhLwPAwH4ZqpxL6rg_KxwaQi9_hdo9I,717
|
|
4
4
|
shield/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
shield/resources/events.py,sha256=uH0TG235kRsoS6sOp-zPIcy5WbbtaPNAhC8aFMy00Po,1093
|
|
6
6
|
shield/resources/sessions.py,sha256=qOnJlpCx2Zk5nEh5TCFkf6v05l4M5SKAeF7klQ9YCQM,1268
|
|
7
7
|
shield/resources/verify.py,sha256=vGN51EWU56jOl8BVfNlfiP0ivkNvkLykicupGIGcpAw,498
|
|
8
|
-
shield_python-0.1.
|
|
9
|
-
shield_python-0.1.
|
|
10
|
-
shield_python-0.1.
|
|
11
|
-
shield_python-0.1.
|
|
8
|
+
shield_python-0.1.2.dist-info/METADATA,sha256=34srNnmwUfJJMxMS-rDteu_41u-YcY1L5_wTcYxX5fk,8044
|
|
9
|
+
shield_python-0.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
10
|
+
shield_python-0.1.2.dist-info/top_level.txt,sha256=XumpIzJqChucal6arFU8u2d4ua7RA9yPcBSJFUi0JDU,7
|
|
11
|
+
shield_python-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|