Fix LICK signing: no sort_keys, raw UTF-8 key encoding
This commit is contained in:
11
lick.py
11
lick.py
@@ -44,13 +44,8 @@ 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:
|
|
||||||
decoded = base64.b64decode(key_raw, validate=True)
|
|
||||||
return decoded
|
|
||||||
except Exception:
|
|
||||||
# Raw string key — encode to bytes directly
|
|
||||||
return key_raw.encode('utf-8')
|
return key_raw.encode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user