keymint 2.1.1__tar.gz → 2.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.
- {keymint-2.1.1/keymint.egg-info → keymint-2.2.0}/PKG-INFO +14 -5
- {keymint-2.1.1 → keymint-2.2.0}/README.md +13 -4
- {keymint-2.1.1 → keymint-2.2.0}/keymint/__init__.py +57 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint/_version.py +1 -1
- {keymint-2.1.1 → keymint-2.2.0/keymint.egg-info}/PKG-INFO +14 -5
- {keymint-2.1.1 → keymint-2.2.0}/setup.py +1 -1
- {keymint-2.1.1 → keymint-2.2.0}/LICENSE +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/MANIFEST.in +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint/identity.py +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint/types.py +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint.egg-info/SOURCES.txt +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint.egg-info/dependency_links.txt +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint.egg-info/requires.txt +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/keymint.egg-info/top_level.txt +0 -0
- {keymint-2.1.1 → keymint-2.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: keymint
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Official Python SDK for KeyMint license management with comprehensive API coverage.
|
|
5
5
|
Home-page: https://github.com/keymint-dev/keymint-python
|
|
6
6
|
Author: KeyMint
|
|
@@ -70,13 +70,13 @@ pip install keymint
|
|
|
70
70
|
import os
|
|
71
71
|
from keymint import KeyMint, identity
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
api_key = os.environ.get('KEYMINT_API_KEY')
|
|
74
74
|
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
|
|
75
75
|
|
|
76
|
-
if not
|
|
77
|
-
raise ValueError('Please set the
|
|
76
|
+
if not api_key or not product_id:
|
|
77
|
+
raise ValueError('Please set the KEYMINT_API_KEY and KEYMINT_PRODUCT_ID environment variables.')
|
|
78
78
|
|
|
79
|
-
sdk = KeyMint(
|
|
79
|
+
sdk = KeyMint(api_key)
|
|
80
80
|
|
|
81
81
|
# 1. Get a stable, unique ID for this machine
|
|
82
82
|
host_id = identity.get_or_create_installation_id()
|
|
@@ -109,6 +109,9 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
109
109
|
| `get_key` | Retrieves detailed information about a key. |
|
|
110
110
|
| `block_key` | Blocks a license key. |
|
|
111
111
|
| `unblock_key` | Unblocks a previously blocked license key. |
|
|
112
|
+
| `floating_checkout` | Checks out a floating license seat. |
|
|
113
|
+
| `floating_heartbeat`| Sends a heartbeat to keep a session alive. |
|
|
114
|
+
| `floating_checkin` | Checks in a session, releasing the seat. |
|
|
112
115
|
|
|
113
116
|
### Customer Management
|
|
114
117
|
|
|
@@ -122,6 +125,12 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
122
125
|
| `toggle_customer_status`| Toggles customer active status. |
|
|
123
126
|
| `delete_customer` | Permanently deletes a customer and their keys. |
|
|
124
127
|
|
|
128
|
+
### Webhook Verification
|
|
129
|
+
|
|
130
|
+
| Method | Description |
|
|
131
|
+
|-------------------------|--------------------------------------------------|
|
|
132
|
+
| `verify_webhook_signature`| Verifies the signature of a webhook request payload. |
|
|
133
|
+
|
|
125
134
|
## License
|
|
126
135
|
MIT
|
|
127
136
|
|
|
@@ -21,13 +21,13 @@ pip install keymint
|
|
|
21
21
|
import os
|
|
22
22
|
from keymint import KeyMint, identity
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
api_key = os.environ.get('KEYMINT_API_KEY')
|
|
25
25
|
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
|
|
26
26
|
|
|
27
|
-
if not
|
|
28
|
-
raise ValueError('Please set the
|
|
27
|
+
if not api_key or not product_id:
|
|
28
|
+
raise ValueError('Please set the KEYMINT_API_KEY and KEYMINT_PRODUCT_ID environment variables.')
|
|
29
29
|
|
|
30
|
-
sdk = KeyMint(
|
|
30
|
+
sdk = KeyMint(api_key)
|
|
31
31
|
|
|
32
32
|
# 1. Get a stable, unique ID for this machine
|
|
33
33
|
host_id = identity.get_or_create_installation_id()
|
|
@@ -60,6 +60,9 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
60
60
|
| `get_key` | Retrieves detailed information about a key. |
|
|
61
61
|
| `block_key` | Blocks a license key. |
|
|
62
62
|
| `unblock_key` | Unblocks a previously blocked license key. |
|
|
63
|
+
| `floating_checkout` | Checks out a floating license seat. |
|
|
64
|
+
| `floating_heartbeat`| Sends a heartbeat to keep a session alive. |
|
|
65
|
+
| `floating_checkin` | Checks in a session, releasing the seat. |
|
|
63
66
|
|
|
64
67
|
### Customer Management
|
|
65
68
|
|
|
@@ -73,6 +76,12 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
73
76
|
| `toggle_customer_status`| Toggles customer active status. |
|
|
74
77
|
| `delete_customer` | Permanently deletes a customer and their keys. |
|
|
75
78
|
|
|
79
|
+
### Webhook Verification
|
|
80
|
+
|
|
81
|
+
| Method | Description |
|
|
82
|
+
|-------------------------|--------------------------------------------------|
|
|
83
|
+
| `verify_webhook_signature`| Verifies the signature of a webhook request payload. |
|
|
84
|
+
|
|
76
85
|
## License
|
|
77
86
|
MIT
|
|
78
87
|
|
|
@@ -193,3 +193,60 @@ class KeyMint:
|
|
|
193
193
|
query_params = {'customerId': params['customerId']}
|
|
194
194
|
return self._handle_request('POST', '/customer/disable', params=None, query_params=query_params)
|
|
195
195
|
|
|
196
|
+
@staticmethod
|
|
197
|
+
def verify_webhook_signature(payload: str, header: str, secret: str, tolerance_seconds: int = 300) -> bool:
|
|
198
|
+
"""
|
|
199
|
+
Verifies a webhook payload signature received from Keymint.
|
|
200
|
+
:param payload: The raw request body as a string.
|
|
201
|
+
:param header: The value of the "Keymint-Signature" header.
|
|
202
|
+
:param secret: The webhook endpoint's signing secret.
|
|
203
|
+
:param tolerance_seconds: Time tolerance in seconds to prevent replay attacks. Defaults to 300 (5 minutes).
|
|
204
|
+
:returns: True if the signature is valid, False otherwise.
|
|
205
|
+
"""
|
|
206
|
+
import hmac
|
|
207
|
+
import hashlib
|
|
208
|
+
import time
|
|
209
|
+
|
|
210
|
+
if not header or not secret:
|
|
211
|
+
return False
|
|
212
|
+
|
|
213
|
+
try:
|
|
214
|
+
# Parse header (e.g. t=1719374021,v1=signature)
|
|
215
|
+
timestamp_str = ""
|
|
216
|
+
signature = ""
|
|
217
|
+
parts = header.split(",")
|
|
218
|
+
for part in parts:
|
|
219
|
+
kv = part.strip().split("=", 1)
|
|
220
|
+
if len(kv) == 2:
|
|
221
|
+
if kv[0] == "t":
|
|
222
|
+
timestamp_str = kv[1]
|
|
223
|
+
elif kv[0] == "v1":
|
|
224
|
+
signature = kv[1]
|
|
225
|
+
|
|
226
|
+
if not timestamp_str or not signature:
|
|
227
|
+
return False
|
|
228
|
+
|
|
229
|
+
# Check timestamp validity
|
|
230
|
+
try:
|
|
231
|
+
timestamp_int = int(timestamp_str)
|
|
232
|
+
except ValueError:
|
|
233
|
+
return False
|
|
234
|
+
|
|
235
|
+
now = int(time.time())
|
|
236
|
+
if abs(now - timestamp_int) > tolerance_seconds:
|
|
237
|
+
return False
|
|
238
|
+
|
|
239
|
+
# Verify HMAC signature
|
|
240
|
+
signable_content = f"{timestamp_str}.{payload}".encode("utf-8")
|
|
241
|
+
expected_signature = hmac.new(
|
|
242
|
+
secret.encode("utf-8"),
|
|
243
|
+
signable_content,
|
|
244
|
+
hashlib.sha256
|
|
245
|
+
).hexdigest()
|
|
246
|
+
|
|
247
|
+
# Constant-time comparison to prevent timing attacks
|
|
248
|
+
return hmac.compare_digest(expected_signature, signature)
|
|
249
|
+
except Exception:
|
|
250
|
+
return False
|
|
251
|
+
|
|
252
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: keymint
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Official Python SDK for KeyMint license management with comprehensive API coverage.
|
|
5
5
|
Home-page: https://github.com/keymint-dev/keymint-python
|
|
6
6
|
Author: KeyMint
|
|
@@ -70,13 +70,13 @@ pip install keymint
|
|
|
70
70
|
import os
|
|
71
71
|
from keymint import KeyMint, identity
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
api_key = os.environ.get('KEYMINT_API_KEY')
|
|
74
74
|
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
|
|
75
75
|
|
|
76
|
-
if not
|
|
77
|
-
raise ValueError('Please set the
|
|
76
|
+
if not api_key or not product_id:
|
|
77
|
+
raise ValueError('Please set the KEYMINT_API_KEY and KEYMINT_PRODUCT_ID environment variables.')
|
|
78
78
|
|
|
79
|
-
sdk = KeyMint(
|
|
79
|
+
sdk = KeyMint(api_key)
|
|
80
80
|
|
|
81
81
|
# 1. Get a stable, unique ID for this machine
|
|
82
82
|
host_id = identity.get_or_create_installation_id()
|
|
@@ -109,6 +109,9 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
109
109
|
| `get_key` | Retrieves detailed information about a key. |
|
|
110
110
|
| `block_key` | Blocks a license key. |
|
|
111
111
|
| `unblock_key` | Unblocks a previously blocked license key. |
|
|
112
|
+
| `floating_checkout` | Checks out a floating license seat. |
|
|
113
|
+
| `floating_heartbeat`| Sends a heartbeat to keep a session alive. |
|
|
114
|
+
| `floating_checkin` | Checks in a session, releasing the seat. |
|
|
112
115
|
|
|
113
116
|
### Customer Management
|
|
114
117
|
|
|
@@ -122,6 +125,12 @@ Keymint provides utilities to uniquely identify machines for node-locking:
|
|
|
122
125
|
| `toggle_customer_status`| Toggles customer active status. |
|
|
123
126
|
| `delete_customer` | Permanently deletes a customer and their keys. |
|
|
124
127
|
|
|
128
|
+
### Webhook Verification
|
|
129
|
+
|
|
130
|
+
| Method | Description |
|
|
131
|
+
|-------------------------|--------------------------------------------------|
|
|
132
|
+
| `verify_webhook_signature`| Verifies the signature of a webhook request payload. |
|
|
133
|
+
|
|
125
134
|
## License
|
|
126
135
|
MIT
|
|
127
136
|
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="keymint",
|
|
8
|
-
version="2.
|
|
8
|
+
version="2.2.0",
|
|
9
9
|
author="KeyMint",
|
|
10
10
|
author_email="cliff@keymint.dev",
|
|
11
11
|
description="Official Python SDK for KeyMint license management with comprehensive API coverage.",
|
|
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
|