tokensafe 1.3.11 → 1.3.12
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.
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/src/__init__.py +1 -1
- package/src/license_manager.py +4 -3
- package/src/version_checker.py +1 -1
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-token-optimizer",
|
|
3
3
|
"displayName": "TokenSafe",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.12",
|
|
5
5
|
"description": "Zero-Loss Token Economy & Context Optimizer for AI Agents. Compresses prompts, slices AST/tool outputs, and prevents stuck loops.",
|
|
6
6
|
"logo": "assets/logo.svg",
|
|
7
7
|
"author": {
|
package/src/__init__.py
CHANGED
package/src/license_manager.py
CHANGED
|
@@ -18,7 +18,7 @@ DATA_DIR = os.path.join(PROJECT_ROOT, "data")
|
|
|
18
18
|
LICENSE_FILE = os.path.join(DATA_DIR, "license.json")
|
|
19
19
|
|
|
20
20
|
# Master Public Key for client-side offline verification (RFC 8032 Ed25519)
|
|
21
|
-
DEFAULT_ED25519_PUBLIC_KEY = "
|
|
21
|
+
DEFAULT_ED25519_PUBLIC_KEY = os.environ.get("TOKENSAFE_PUBLIC_KEY", "3911e2ffe5ad07ee23be392b88f238af302f9d3a0bf51881de8b5e0e6af71430")
|
|
22
22
|
# Private key for cloud server signing (never distributed to client, loaded strictly from environment)
|
|
23
23
|
DEFAULT_ED25519_PRIVATE_KEY = os.environ.get("TOKENSAFE_PRIVATE_KEY", "")
|
|
24
24
|
# Rotated HMAC salt for backward compatibility with TS1 legacy licenses
|
|
@@ -170,7 +170,8 @@ class LicenseManager:
|
|
|
170
170
|
if not priv_hex:
|
|
171
171
|
raise ValueError("TOKENSAFE_PRIVATE_KEY environment variable is required to generate license signatures.")
|
|
172
172
|
priv_bytes = bytes.fromhex(priv_hex)
|
|
173
|
-
|
|
173
|
+
pub_hex = os.environ.get("TOKENSAFE_PUBLIC_KEY") or DEFAULT_ED25519_PUBLIC_KEY
|
|
174
|
+
pub_bytes = bytes.fromhex(pub_hex)
|
|
174
175
|
sig_raw = _ed25519_sign_bytes(payload_bytes, priv_bytes, pub_bytes)
|
|
175
176
|
sig_b64 = base64.urlsafe_b64encode(sig_raw).decode("ascii").rstrip("=")
|
|
176
177
|
return f"TS2.{payload_b64}.{sig_b64}"
|
|
@@ -211,7 +212,7 @@ class LicenseManager:
|
|
|
211
212
|
|
|
212
213
|
# 1. Asymmetric Ed25519 Verification (TS2)
|
|
213
214
|
if schema_ver == "TS2":
|
|
214
|
-
pub_hex = public_key or DEFAULT_ED25519_PUBLIC_KEY
|
|
215
|
+
pub_hex = public_key or os.environ.get("TOKENSAFE_PUBLIC_KEY") or DEFAULT_ED25519_PUBLIC_KEY
|
|
215
216
|
try:
|
|
216
217
|
pub_bytes = bytes.fromhex(pub_hex)
|
|
217
218
|
padded_sig = sig_part + "=" * (-len(sig_part) % 4)
|
package/src/version_checker.py
CHANGED
|
@@ -14,7 +14,7 @@ import urllib.request
|
|
|
14
14
|
import urllib.error
|
|
15
15
|
from typing import Dict, Any, Optional, Tuple
|
|
16
16
|
|
|
17
|
-
CURRENT_VERSION = "1.3.
|
|
17
|
+
CURRENT_VERSION = "1.3.12"
|
|
18
18
|
CACHE_TTL = 86400 # 24 hours
|
|
19
19
|
|
|
20
20
|
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|