build v_1.0.1

This commit is contained in:
2026-07-21 15:05:52 +03:00
commit 6563d755d8
27 changed files with 1974 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
"""PSK redaction for safe logging.
Walks any nested dict/list structure and blanks out the value of any dict
key literally named "psk" (Neutron's and Sprut's shared field name) when
that value is not null. Used only for logging -- the real value is always
used wherever the original object is read for actual API calls/storage.
"""
from __future__ import annotations
from typing import Any
_PSK_KEYS = {"psk"}
_REDACTED = "***REDACTED***"
def redact_psk(value: Any) -> Any:
if isinstance(value, dict):
return {
key: (_REDACTED if key in _PSK_KEYS and val is not None else redact_psk(val))
for key, val in value.items()
}
if isinstance(value, list):
return [redact_psk(item) for item in value]
return value