Fix LICK signing: no sort_keys, raw UTF-8 key encoding

This commit is contained in:
VZ Build
2026-07-14 17:38:38 +00:00
parent 3b845698f8
commit 83eb60d1aa

13
lick.py
View File

@@ -44,14 +44,9 @@ def _get_lick_key() -> bytes:
if not key_raw: if not key_raw:
raise ValueError('LICK key not configured — set VECTOR_ZULU_LICK_KEY') raise ValueError('LICK key not configured — set VECTOR_ZULU_LICK_KEY')
# Try base64 decode first (for keys that are base64-encoded in Key Vault) # Key is raw string — encode to bytes directly
# Fall back to raw bytes if not valid base64 # (NotMyCircu$_NotMyMonkey$ is raw UTF-8, not base64)
try: return key_raw.encode('utf-8')
decoded = base64.b64decode(key_raw, validate=True)
return decoded
except Exception:
# Raw string key — encode to bytes directly
return key_raw.encode('utf-8')
def canonicalize(payload: dict) -> str: def canonicalize(payload: dict) -> str:
@@ -59,7 +54,7 @@ def canonicalize(payload: dict) -> str:
Canonical JSON serialization per LICK spec. Canonical JSON serialization per LICK spec.
compact JSON, no whitespace, separators=(',',':'), sort_keys=True compact JSON, no whitespace, separators=(',',':'), sort_keys=True
""" """
return json.dumps(payload, separators=(',', ':'), sort_keys=True) return json.dumps(payload, separators=(',', ':'))
def sign_canonical(payload: dict, timestamp: Optional[int] = None) -> str: def sign_canonical(payload: dict, timestamp: Optional[int] = None) -> str: